azure-quantum 2.4.0__py3-none-any.whl → 2.5.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/quantum/_client/__init__.py +11 -5
- azure/quantum/_client/_client.py +40 -49
- azure/quantum/_client/_configuration.py +34 -41
- azure/quantum/_client/_model_base.py +1159 -0
- azure/quantum/_client/_serialization.py +285 -172
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/_client/aio/__init__.py +29 -0
- azure/quantum/_client/aio/_client.py +143 -0
- azure/quantum/_client/aio/_configuration.py +82 -0
- azure/quantum/_client/aio/_patch.py +20 -0
- azure/quantum/_client/aio/operations/__init__.py +35 -0
- azure/quantum/_client/aio/operations/_operations.py +1824 -0
- azure/quantum/_client/aio/operations/_patch.py +20 -0
- azure/quantum/_client/models/__init__.py +41 -30
- azure/quantum/_client/models/_enums.py +34 -4
- azure/quantum/_client/models/_models.py +435 -764
- azure/quantum/_client/operations/__init__.py +16 -10
- azure/quantum/_client/operations/_operations.py +1191 -769
- azure/quantum/version.py +1 -1
- azure/quantum/workspace.py +371 -38
- {azure_quantum-2.4.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/METADATA +1 -1
- {azure_quantum-2.4.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/RECORD +24 -17
- azure/quantum/_client/_vendor.py +0 -20
- {azure_quantum-2.4.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/WHEEL +0 -0
- {azure_quantum-2.4.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/top_level.txt +0 -0
azure/quantum/version.py
CHANGED
azure/quantum/workspace.py
CHANGED
|
@@ -10,6 +10,7 @@ an Azure Quantum Workspace.
|
|
|
10
10
|
from __future__ import annotations
|
|
11
11
|
from datetime import datetime
|
|
12
12
|
import logging
|
|
13
|
+
from urllib.parse import quote
|
|
13
14
|
from typing import (
|
|
14
15
|
Any,
|
|
15
16
|
Dict,
|
|
@@ -20,7 +21,9 @@ from typing import (
|
|
|
20
21
|
Tuple,
|
|
21
22
|
Union,
|
|
22
23
|
)
|
|
23
|
-
from azure.
|
|
24
|
+
from azure.core.paging import ItemPaged
|
|
25
|
+
from azure.quantum._client import ServicesClient
|
|
26
|
+
from azure.quantum._client.models import JobDetails, ItemDetails, SessionDetails
|
|
24
27
|
from azure.quantum._client.operations import (
|
|
25
28
|
JobsOperations,
|
|
26
29
|
StorageOperations,
|
|
@@ -49,7 +52,6 @@ from azure.quantum.storage import (
|
|
|
49
52
|
if TYPE_CHECKING:
|
|
50
53
|
from azure.quantum.target import Target
|
|
51
54
|
|
|
52
|
-
|
|
53
55
|
logger = logging.getLogger(__name__)
|
|
54
56
|
|
|
55
57
|
__all__ = ["Workspace"]
|
|
@@ -139,6 +141,9 @@ class Workspace:
|
|
|
139
141
|
|
|
140
142
|
self._connection_params = connection_params
|
|
141
143
|
self._storage = storage
|
|
144
|
+
self._subscription_id = connection_params.subscription_id
|
|
145
|
+
self._resource_group = connection_params.resource_group
|
|
146
|
+
self._workspace_name = connection_params.workspace_name
|
|
142
147
|
|
|
143
148
|
# Create QuantumClient
|
|
144
149
|
self._client = self._create_client()
|
|
@@ -213,7 +218,7 @@ class Workspace:
|
|
|
213
218
|
"""
|
|
214
219
|
return self._storage
|
|
215
220
|
|
|
216
|
-
def _create_client(self) ->
|
|
221
|
+
def _create_client(self) -> ServicesClient:
|
|
217
222
|
""""
|
|
218
223
|
An internal method to (re)create the underlying Azure SDK REST API client.
|
|
219
224
|
|
|
@@ -224,12 +229,12 @@ class Workspace:
|
|
|
224
229
|
kwargs = {}
|
|
225
230
|
if connection_params.api_version:
|
|
226
231
|
kwargs["api_version"] = connection_params.api_version
|
|
227
|
-
client =
|
|
232
|
+
client = ServicesClient(
|
|
233
|
+
region=connection_params.location,
|
|
228
234
|
credential=connection_params.get_credential_or_default(),
|
|
229
235
|
subscription_id=connection_params.subscription_id,
|
|
230
236
|
resource_group_name=connection_params.resource_group,
|
|
231
237
|
workspace_name=connection_params.workspace_name,
|
|
232
|
-
azure_region=connection_params.location,
|
|
233
238
|
user_agent=connection_params.get_full_user_agent(),
|
|
234
239
|
credential_scopes = [ConnectionConstants.DATA_PLANE_CREDENTIAL_SCOPE],
|
|
235
240
|
endpoint=connection_params.quantum_endpoint,
|
|
@@ -352,7 +357,11 @@ class Workspace:
|
|
|
352
357
|
blob_details = BlobDetails(
|
|
353
358
|
container_name=container_name, blob_name=blob_name
|
|
354
359
|
)
|
|
355
|
-
container_uri = client.
|
|
360
|
+
container_uri = client.get_sas_uri(
|
|
361
|
+
self._subscription_id,
|
|
362
|
+
self._resource_group,
|
|
363
|
+
self._workspace_name,
|
|
364
|
+
blob_details=blob_details)
|
|
356
365
|
|
|
357
366
|
logger.debug("Container URI from service: %s", container_uri)
|
|
358
367
|
return container_uri.sas_uri
|
|
@@ -368,8 +377,12 @@ class Workspace:
|
|
|
368
377
|
:rtype: Job
|
|
369
378
|
"""
|
|
370
379
|
client = self._get_jobs_client()
|
|
371
|
-
details = client.
|
|
372
|
-
|
|
380
|
+
details = client.create_or_replace(
|
|
381
|
+
self._subscription_id,
|
|
382
|
+
self._resource_group,
|
|
383
|
+
self._workspace_name,
|
|
384
|
+
job.details.id,
|
|
385
|
+
job.details
|
|
373
386
|
)
|
|
374
387
|
return Job(self, details)
|
|
375
388
|
|
|
@@ -385,8 +398,16 @@ class Workspace:
|
|
|
385
398
|
:rtype: Job
|
|
386
399
|
"""
|
|
387
400
|
client = self._get_jobs_client()
|
|
388
|
-
client.
|
|
389
|
-
|
|
401
|
+
client.delete(
|
|
402
|
+
self._subscription_id,
|
|
403
|
+
self._resource_group,
|
|
404
|
+
self._workspace_name,
|
|
405
|
+
job.details.id)
|
|
406
|
+
details = client.get(
|
|
407
|
+
self._subscription_id,
|
|
408
|
+
self._resource_group,
|
|
409
|
+
self._workspace_name,
|
|
410
|
+
job.id)
|
|
390
411
|
return Job(self, details)
|
|
391
412
|
|
|
392
413
|
def get_job(self, job_id: str) -> Job:
|
|
@@ -404,7 +425,11 @@ class Workspace:
|
|
|
404
425
|
from azure.quantum.target import Target
|
|
405
426
|
|
|
406
427
|
client = self._get_jobs_client()
|
|
407
|
-
details = client.get(
|
|
428
|
+
details = client.get(
|
|
429
|
+
self._subscription_id,
|
|
430
|
+
self._resource_group,
|
|
431
|
+
self._workspace_name,
|
|
432
|
+
job_id)
|
|
408
433
|
target_factory = TargetFactory(base_cls=Target, workspace=self)
|
|
409
434
|
# pylint: disable=protected-access
|
|
410
435
|
target_cls = target_factory._target_cls(
|
|
@@ -416,8 +441,14 @@ class Workspace:
|
|
|
416
441
|
def list_jobs(
|
|
417
442
|
self,
|
|
418
443
|
name_match: Optional[str] = None,
|
|
419
|
-
|
|
420
|
-
|
|
444
|
+
job_type: Optional[list[str]]= None,
|
|
445
|
+
provider: Optional[list[str]]= None,
|
|
446
|
+
target: Optional[list[str]]= None,
|
|
447
|
+
status: Optional[list[JobStatus]] = None,
|
|
448
|
+
created_after: Optional[datetime] = None,
|
|
449
|
+
created_before: Optional[datetime] = None,
|
|
450
|
+
orderby_property: Optional[str] = None,
|
|
451
|
+
is_asc: Optional[bool] = True
|
|
421
452
|
) -> List[Job]:
|
|
422
453
|
"""
|
|
423
454
|
Returns list of jobs that meet optional (limited) filter criteria.
|
|
@@ -434,17 +465,54 @@ class Workspace:
|
|
|
434
465
|
:return: Jobs that matched the search criteria.
|
|
435
466
|
:rtype: typing.List[Job]
|
|
436
467
|
"""
|
|
437
|
-
|
|
438
|
-
|
|
468
|
+
paginator = self.list_jobs_paginated (
|
|
469
|
+
name_match=name_match,
|
|
470
|
+
job_type=job_type,
|
|
471
|
+
provider=provider,
|
|
472
|
+
target=target,
|
|
473
|
+
status=status,
|
|
474
|
+
created_after=created_after,
|
|
475
|
+
created_before=created_before,
|
|
476
|
+
orderby_property=orderby_property,
|
|
477
|
+
is_asc=is_asc)
|
|
439
478
|
|
|
440
479
|
result = []
|
|
441
|
-
for j in
|
|
480
|
+
for j in paginator:
|
|
442
481
|
deserialized_job = Job(self, j)
|
|
443
|
-
|
|
444
|
-
result.append(deserialized_job)
|
|
482
|
+
result.append(deserialized_job)
|
|
445
483
|
|
|
446
484
|
return result
|
|
447
485
|
|
|
486
|
+
def list_jobs_paginated(
|
|
487
|
+
self,
|
|
488
|
+
*,
|
|
489
|
+
name_match: Optional[str] = None,
|
|
490
|
+
job_type: Optional[str]= None,
|
|
491
|
+
provider: Optional[list[str]]= None,
|
|
492
|
+
target: Optional[list[str]]= None,
|
|
493
|
+
status: Optional[list[JobStatus]] = None,
|
|
494
|
+
created_after: Optional[datetime] = None,
|
|
495
|
+
created_before: Optional[datetime] = None,
|
|
496
|
+
skip: Optional[int] = 0,
|
|
497
|
+
top: Optional[int]=100,
|
|
498
|
+
orderby_property: Optional[str] = None,
|
|
499
|
+
is_asc: Optional[bool] = True
|
|
500
|
+
) -> ItemPaged[JobDetails]:
|
|
501
|
+
client = self._get_jobs_client()
|
|
502
|
+
|
|
503
|
+
job_filter = self._create_filter(
|
|
504
|
+
job_name=name_match,
|
|
505
|
+
job_type=job_type,
|
|
506
|
+
provider_ids=provider,
|
|
507
|
+
target=target,
|
|
508
|
+
status=status,
|
|
509
|
+
created_after=created_after,
|
|
510
|
+
created_before=created_before
|
|
511
|
+
)
|
|
512
|
+
orderby = self._create_orderby(orderby_property, is_asc)
|
|
513
|
+
|
|
514
|
+
return client.list(subscription_id=self.subscription_id, resource_group_name=self.resource_group, workspace_name=self._workspace_name, filter=job_filter, orderby=orderby, top = top, skip = skip)
|
|
515
|
+
|
|
448
516
|
def _get_target_status(
|
|
449
517
|
self,
|
|
450
518
|
name: Optional[str] = None,
|
|
@@ -465,7 +533,10 @@ class Workspace:
|
|
|
465
533
|
"""
|
|
466
534
|
return [
|
|
467
535
|
(provider.id, target)
|
|
468
|
-
for provider in self._client.providers.
|
|
536
|
+
for provider in self._client.providers.list(
|
|
537
|
+
self._subscription_id,
|
|
538
|
+
self._resource_group,
|
|
539
|
+
self._workspace_name)
|
|
469
540
|
for target in provider.targets
|
|
470
541
|
if (provider_id is None or provider.id.lower() == provider_id.lower())
|
|
471
542
|
and (name is None or target.id.lower() == name.lower())
|
|
@@ -521,10 +592,24 @@ class Workspace:
|
|
|
521
592
|
:rtype: typing.List[typing.Dict[str, typing.Any]
|
|
522
593
|
"""
|
|
523
594
|
client = self._get_quotas_client()
|
|
524
|
-
return [q.as_dict() for q in client.list(
|
|
595
|
+
return [q.as_dict() for q in client.list(
|
|
596
|
+
self._subscription_id,
|
|
597
|
+
self._resource_group,
|
|
598
|
+
self._workspace_name
|
|
599
|
+
)]
|
|
525
600
|
|
|
526
601
|
def list_top_level_items(
|
|
527
|
-
self
|
|
602
|
+
self,
|
|
603
|
+
name_match: Optional[str] = None,
|
|
604
|
+
item_type: Optional[list[str]]= None,
|
|
605
|
+
job_type: Optional[list[str]]= None,
|
|
606
|
+
provider: Optional[list[str]]= None,
|
|
607
|
+
target: Optional[list[str]]= None,
|
|
608
|
+
status: Optional[list[JobStatus]] = None,
|
|
609
|
+
created_after: Optional[datetime] = None,
|
|
610
|
+
created_before: Optional[datetime] = None,
|
|
611
|
+
orderby_property: Optional[str] = None,
|
|
612
|
+
is_asc: Optional[bool] = True
|
|
528
613
|
) -> List[Union[Job, Session]]:
|
|
529
614
|
"""
|
|
530
615
|
Get a list of top level items for the given workspace,
|
|
@@ -534,14 +619,64 @@ class Workspace:
|
|
|
534
619
|
:return: List of Workspace top level Jobs or Sessions.
|
|
535
620
|
:rtype: typing.List[typing.Union[Job, Session]]
|
|
536
621
|
"""
|
|
537
|
-
|
|
538
|
-
|
|
622
|
+
paginator = self.list_top_level_items_paginated(
|
|
623
|
+
name_match=name_match,
|
|
624
|
+
item_type=item_type,
|
|
625
|
+
job_type=job_type,
|
|
626
|
+
provider=provider,
|
|
627
|
+
target=target,
|
|
628
|
+
status=status,
|
|
629
|
+
created_after=created_after,
|
|
630
|
+
created_before=created_before,
|
|
631
|
+
orderby_property=orderby_property,
|
|
632
|
+
is_asc=is_asc
|
|
633
|
+
)
|
|
634
|
+
|
|
539
635
|
result = [WorkspaceItemFactory.__new__(workspace=self, item_details=item_details)
|
|
540
|
-
for item_details in
|
|
636
|
+
for item_details in paginator]
|
|
541
637
|
return result
|
|
542
638
|
|
|
639
|
+
def list_top_level_items_paginated(
|
|
640
|
+
self,
|
|
641
|
+
*,
|
|
642
|
+
name_match: Optional[str] = None,
|
|
643
|
+
item_type: Optional[str]= None,
|
|
644
|
+
job_type: Optional[str]= None,
|
|
645
|
+
provider: Optional[list[str]]= None,
|
|
646
|
+
target: Optional[list[str]]= None,
|
|
647
|
+
status: Optional[list[JobStatus]] = None,
|
|
648
|
+
created_after: Optional[datetime] = None,
|
|
649
|
+
created_before: Optional[datetime] = None,
|
|
650
|
+
skip: Optional[int] = 0,
|
|
651
|
+
top: Optional[int]=100,
|
|
652
|
+
orderby_property: Optional[str] = None,
|
|
653
|
+
is_asc: Optional[bool] = True
|
|
654
|
+
) -> ItemPaged[ItemDetails]:
|
|
655
|
+
client = self._get_top_level_items_client()
|
|
656
|
+
|
|
657
|
+
top_level_item_filter = self._create_filter(
|
|
658
|
+
job_name=name_match,
|
|
659
|
+
item_type=item_type,
|
|
660
|
+
job_type=job_type,
|
|
661
|
+
provider_ids=provider,
|
|
662
|
+
target=target,
|
|
663
|
+
status=status,
|
|
664
|
+
created_after=created_after,
|
|
665
|
+
created_before=created_before
|
|
666
|
+
)
|
|
667
|
+
orderby = self._create_orderby(orderby_property, is_asc)
|
|
668
|
+
|
|
669
|
+
return client.list(subscription_id=self.subscription_id, resource_group_name=self.resource_group, workspace_name=self._workspace_name, filter=top_level_item_filter, orderby=orderby, top = top, skip = skip)
|
|
670
|
+
|
|
543
671
|
def list_sessions(
|
|
544
|
-
self
|
|
672
|
+
self,
|
|
673
|
+
provider: Optional[list[str]]= None,
|
|
674
|
+
target: Optional[list[str]]= None,
|
|
675
|
+
status: Optional[list[JobStatus]] = None,
|
|
676
|
+
created_after: Optional[datetime] = None,
|
|
677
|
+
created_before: Optional[datetime] = None,
|
|
678
|
+
orderby_property: Optional[str] = None,
|
|
679
|
+
is_asc: Optional[bool] = True
|
|
545
680
|
) -> List[Session]:
|
|
546
681
|
"""
|
|
547
682
|
Get the list of sessions in the given workspace.
|
|
@@ -549,11 +684,50 @@ class Workspace:
|
|
|
549
684
|
:return: List of Workspace Sessions.
|
|
550
685
|
:rtype: typing.List[Session]
|
|
551
686
|
"""
|
|
552
|
-
|
|
553
|
-
|
|
687
|
+
paginator = self.list_sessions_paginated(
|
|
688
|
+
provider=provider,
|
|
689
|
+
target=target,
|
|
690
|
+
status=status,
|
|
691
|
+
created_after=created_after,
|
|
692
|
+
created_before=created_before,
|
|
693
|
+
orderby_property=orderby_property,
|
|
694
|
+
is_asc=is_asc)
|
|
695
|
+
|
|
554
696
|
result = [Session(workspace=self,details=session_details)
|
|
555
|
-
for session_details in
|
|
697
|
+
for session_details in paginator]
|
|
556
698
|
return result
|
|
699
|
+
|
|
700
|
+
def list_sessions_paginated(
|
|
701
|
+
self,
|
|
702
|
+
*,
|
|
703
|
+
provider: Optional[list[str]]= None,
|
|
704
|
+
target: Optional[list[str]]= None,
|
|
705
|
+
status: Optional[list[JobStatus]] = None,
|
|
706
|
+
created_after: Optional[datetime] = None,
|
|
707
|
+
created_before: Optional[datetime] = None,
|
|
708
|
+
skip: Optional[int] = 0,
|
|
709
|
+
top: Optional[int]=100,
|
|
710
|
+
orderby_property: Optional[str] = None,
|
|
711
|
+
is_asc: Optional[bool] = True
|
|
712
|
+
) -> ItemPaged[SessionDetails]:
|
|
713
|
+
"""
|
|
714
|
+
Get the list of sessions in the given workspace.
|
|
715
|
+
|
|
716
|
+
:return: List of Workspace Sessions.
|
|
717
|
+
:rtype: typing.List[Session]
|
|
718
|
+
"""
|
|
719
|
+
client = self._get_sessions_client()
|
|
720
|
+
session_filter = self._create_filter(
|
|
721
|
+
provider_ids=provider,
|
|
722
|
+
target=target,
|
|
723
|
+
status=status,
|
|
724
|
+
created_after=created_after,
|
|
725
|
+
created_before=created_before
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
orderby = self._create_orderby(orderby_property=orderby_property, is_asc=is_asc)
|
|
729
|
+
|
|
730
|
+
return client.list(subscription_id=self.subscription_id, resource_group_name=self.resource_group, workspace_name=self._workspace_name, filter = session_filter, orderby=orderby, skip=skip, top=top)
|
|
557
731
|
|
|
558
732
|
def open_session(
|
|
559
733
|
self,
|
|
@@ -569,9 +743,12 @@ class Workspace:
|
|
|
569
743
|
:rtype: Session
|
|
570
744
|
"""
|
|
571
745
|
client = self._get_sessions_client()
|
|
572
|
-
session.details = client.
|
|
573
|
-
|
|
574
|
-
|
|
746
|
+
session.details = client.create_or_replace(
|
|
747
|
+
self._subscription_id,
|
|
748
|
+
self._resource_group,
|
|
749
|
+
self._workspace_name,
|
|
750
|
+
session.id,
|
|
751
|
+
session.details)
|
|
575
752
|
|
|
576
753
|
def close_session(
|
|
577
754
|
self,
|
|
@@ -587,9 +764,17 @@ class Workspace:
|
|
|
587
764
|
"""
|
|
588
765
|
client = self._get_sessions_client()
|
|
589
766
|
if not session.is_in_terminal_state():
|
|
590
|
-
session.details = client.close(
|
|
767
|
+
session.details = client.close(
|
|
768
|
+
self._subscription_id,
|
|
769
|
+
self._resource_group,
|
|
770
|
+
self._workspace_name,
|
|
771
|
+
session_id=session.id)
|
|
591
772
|
else:
|
|
592
|
-
session.details = client.get(
|
|
773
|
+
session.details = client.get(
|
|
774
|
+
self._subscription_id,
|
|
775
|
+
self._resource_group,
|
|
776
|
+
self._workspace_name,
|
|
777
|
+
session_id=session.id)
|
|
593
778
|
|
|
594
779
|
if session.target:
|
|
595
780
|
if (session.target.latest_session
|
|
@@ -623,13 +808,21 @@ class Workspace:
|
|
|
623
808
|
:rtype: Session
|
|
624
809
|
"""
|
|
625
810
|
client = self._get_sessions_client()
|
|
626
|
-
session_details = client.get(
|
|
811
|
+
session_details = client.get(
|
|
812
|
+
self._subscription_id,
|
|
813
|
+
self._resource_group,
|
|
814
|
+
self._workspace_name,
|
|
815
|
+
session_id=session_id)
|
|
627
816
|
result = Session(workspace=self, details=session_details)
|
|
628
817
|
return result
|
|
629
818
|
|
|
630
819
|
def list_session_jobs(
|
|
631
820
|
self,
|
|
632
|
-
session_id: str
|
|
821
|
+
session_id: str,
|
|
822
|
+
name_match: Optional[str] = None,
|
|
823
|
+
status: Optional[list[JobStatus]] = None,
|
|
824
|
+
orderby_property: Optional[str] = None,
|
|
825
|
+
is_asc: Optional[bool] = True
|
|
633
826
|
) -> List[Job]:
|
|
634
827
|
"""
|
|
635
828
|
Gets all jobs associated with a session.
|
|
@@ -640,12 +833,48 @@ class Workspace:
|
|
|
640
833
|
:return: List of all jobs associated with a session.
|
|
641
834
|
:rtype: typing.List[Job]
|
|
642
835
|
"""
|
|
643
|
-
|
|
644
|
-
|
|
836
|
+
paginator = self.list_session_jobs_paginated(
|
|
837
|
+
session_id=session_id,
|
|
838
|
+
name_match=name_match,
|
|
839
|
+
status=status,
|
|
840
|
+
orderby_property=orderby_property,
|
|
841
|
+
is_asc=is_asc)
|
|
842
|
+
|
|
645
843
|
result = [Job(workspace=self, job_details=job_details)
|
|
646
|
-
for job_details in
|
|
844
|
+
for job_details in paginator]
|
|
647
845
|
return result
|
|
648
846
|
|
|
847
|
+
def list_session_jobs_paginated(
|
|
848
|
+
self,
|
|
849
|
+
*,
|
|
850
|
+
session_id: str,
|
|
851
|
+
name_match: Optional[str] = None,
|
|
852
|
+
status: Optional[list[JobStatus]] = None,
|
|
853
|
+
skip: Optional[int] = 0,
|
|
854
|
+
top: Optional[int]=100,
|
|
855
|
+
orderby_property: Optional[str] = None,
|
|
856
|
+
is_asc: Optional[bool] = True
|
|
857
|
+
) -> ItemPaged[JobDetails]:
|
|
858
|
+
"""
|
|
859
|
+
Gets all jobs associated with a session.
|
|
860
|
+
|
|
861
|
+
:param session_id:
|
|
862
|
+
The id of session.
|
|
863
|
+
|
|
864
|
+
:return: List of all jobs associated with a session.
|
|
865
|
+
:rtype: typing.List[Job]
|
|
866
|
+
"""
|
|
867
|
+
client = self._get_sessions_client()
|
|
868
|
+
|
|
869
|
+
session_job_filter = self._create_filter(
|
|
870
|
+
job_name=name_match,
|
|
871
|
+
status=status
|
|
872
|
+
)
|
|
873
|
+
|
|
874
|
+
orderby = self._create_orderby(orderby_property=orderby_property, is_asc=is_asc)
|
|
875
|
+
|
|
876
|
+
return client.jobs_list(subscription_id=self.subscription_id, resource_group_name=self.resource_group, workspace_name=self._workspace_name, session_id=session_id, filter = session_job_filter, orderby=orderby, skip=skip, top=top)
|
|
877
|
+
|
|
649
878
|
def get_container_uri(
|
|
650
879
|
self,
|
|
651
880
|
job_id: Optional[str] = None,
|
|
@@ -691,3 +920,107 @@ class Workspace:
|
|
|
691
920
|
self.storage, container_name
|
|
692
921
|
)
|
|
693
922
|
return container_uri
|
|
923
|
+
|
|
924
|
+
def _create_filter(self,
|
|
925
|
+
job_name: Optional[str] = None,
|
|
926
|
+
item_type: Optional[List[str]] = None,
|
|
927
|
+
job_type: Optional[List[str]] = None,
|
|
928
|
+
provider_ids: Optional[List[str]] = None,
|
|
929
|
+
target: Optional[List[str]] = None,
|
|
930
|
+
status: Optional[List[str]] = None,
|
|
931
|
+
created_after: Optional[datetime] = None,
|
|
932
|
+
created_before: Optional[datetime] = None,) -> str:
|
|
933
|
+
has_filter = False
|
|
934
|
+
filter_string = ""
|
|
935
|
+
|
|
936
|
+
if job_name:
|
|
937
|
+
filter_string += f"startswith(Name, '{job_name}')"
|
|
938
|
+
has_filter = True
|
|
939
|
+
|
|
940
|
+
if (item_type is not None and item_type.count != 0):
|
|
941
|
+
if has_filter:
|
|
942
|
+
filter_string += " and "
|
|
943
|
+
|
|
944
|
+
filter_string += "("
|
|
945
|
+
|
|
946
|
+
item_type_filter = " or ".join([f"ItemType eq '{iid}'" for iid in item_type])
|
|
947
|
+
|
|
948
|
+
filter_string += f"{item_type_filter})"
|
|
949
|
+
has_filter = True
|
|
950
|
+
|
|
951
|
+
if (job_type is not None and job_type.count != 0):
|
|
952
|
+
if has_filter:
|
|
953
|
+
filter_string += " and "
|
|
954
|
+
|
|
955
|
+
filter_string += "("
|
|
956
|
+
|
|
957
|
+
job_type_filter = " or ".join([f"JobType eq '{jid}'" for jid in job_type])
|
|
958
|
+
|
|
959
|
+
filter_string += f"{job_type_filter})"
|
|
960
|
+
has_filter = True
|
|
961
|
+
|
|
962
|
+
if (provider_ids is not None and provider_ids.count != 0):
|
|
963
|
+
if has_filter:
|
|
964
|
+
filter_string += " and "
|
|
965
|
+
|
|
966
|
+
filter_string += "("
|
|
967
|
+
|
|
968
|
+
provider_filter = " or ".join([f"ProviderId eq '{pid}'" for pid in provider_ids])
|
|
969
|
+
|
|
970
|
+
filter_string += f"{provider_filter})"
|
|
971
|
+
has_filter = True
|
|
972
|
+
|
|
973
|
+
if (target is not None and target.count != 0):
|
|
974
|
+
if has_filter:
|
|
975
|
+
filter_string += " and "
|
|
976
|
+
|
|
977
|
+
filter_string += "("
|
|
978
|
+
|
|
979
|
+
target_filter = " or ".join([f"Target eq '{tid}'" for tid in target])
|
|
980
|
+
|
|
981
|
+
filter_string += f"{target_filter})"
|
|
982
|
+
has_filter = True
|
|
983
|
+
|
|
984
|
+
if (status is not None and status.count != 0):
|
|
985
|
+
if has_filter:
|
|
986
|
+
filter_string += " and "
|
|
987
|
+
|
|
988
|
+
filter_string += "("
|
|
989
|
+
|
|
990
|
+
status_filter = " or ".join([f"State eq '{sid}'" for sid in status])
|
|
991
|
+
|
|
992
|
+
filter_string += f"{status_filter})"
|
|
993
|
+
has_filter = True
|
|
994
|
+
|
|
995
|
+
if created_after is not None:
|
|
996
|
+
if has_filter:
|
|
997
|
+
filter_string += " and "
|
|
998
|
+
|
|
999
|
+
iso_date_string = created_after.date().isoformat()
|
|
1000
|
+
filter_string += f"CreationTime ge {iso_date_string}"
|
|
1001
|
+
|
|
1002
|
+
if created_before is not None:
|
|
1003
|
+
if has_filter:
|
|
1004
|
+
filter_string += " and "
|
|
1005
|
+
|
|
1006
|
+
iso_date_string = created_before.date().isoformat()
|
|
1007
|
+
filter_string += f"CreationTime le {iso_date_string}"
|
|
1008
|
+
|
|
1009
|
+
if filter_string:
|
|
1010
|
+
return filter_string
|
|
1011
|
+
else:
|
|
1012
|
+
return None
|
|
1013
|
+
|
|
1014
|
+
def _create_orderby(self, orderby_property: str, is_asc: bool) -> str:
|
|
1015
|
+
if orderby_property:
|
|
1016
|
+
var_names = ["Name", "ItemType", "JobType", "ProviderId", "Target", "State", "CreationTime"]
|
|
1017
|
+
|
|
1018
|
+
if orderby_property in var_names:
|
|
1019
|
+
orderby = f"{orderby_property} asc" if is_asc else f"{orderby_property} desc"
|
|
1020
|
+
else:
|
|
1021
|
+
raise ValueError(f"Invalid orderby property: {orderby_property}")
|
|
1022
|
+
|
|
1023
|
+
return orderby
|
|
1024
|
+
else:
|
|
1025
|
+
return None
|
|
1026
|
+
|
|
@@ -2,26 +2,33 @@ azure/quantum/__init__.py,sha256=Za8xZY4lzFkW8m4ero-bqrfN437D2NRukM77ukb4GPM,508
|
|
|
2
2
|
azure/quantum/_constants.py,sha256=nDL_QrGdI_Zz_cvTB9nVgfE7J6A_Boo1ollMYqsiEBs,3499
|
|
3
3
|
azure/quantum/_workspace_connection_params.py,sha256=KoT90U89Dj6pVwAKp_ENJL1hyTF0oQe7w0QioOGvjXg,21685
|
|
4
4
|
azure/quantum/storage.py,sha256=_4bMniDk9LrB_K5CQwuCivJFZXdmhRvU2b6Z3xxXw9I,12556
|
|
5
|
-
azure/quantum/version.py,sha256=
|
|
6
|
-
azure/quantum/workspace.py,sha256=
|
|
5
|
+
azure/quantum/version.py,sha256=xGEvcIhZU7wg1ZhopXL0Dk_7CMW1CYRXUUtsJG8Qtks,240
|
|
6
|
+
azure/quantum/workspace.py,sha256=zhhSMq_l7ybuhU_MvsD5cQW8nL03ZyKjkczJ9jjpXcY,35579
|
|
7
7
|
azure/quantum/_authentication/__init__.py,sha256=bniNZlS0hMIjO_y7DevGBAS6MixyA5pbPHcdGipUWM4,236
|
|
8
8
|
azure/quantum/_authentication/_chained.py,sha256=0rdohB_fVGFHUhlly9sGxqQTBTZGpGxtlBqNHDFbAqE,4848
|
|
9
9
|
azure/quantum/_authentication/_default.py,sha256=RzhK5UNQb6TK95VQI4o8Gm2nxtOaz64yA0J9Tw9zpW4,6625
|
|
10
10
|
azure/quantum/_authentication/_token.py,sha256=mOrvibDiOgkDnqU1OBIw9PyIv-np6DkdxMNC4UtuGkc,3616
|
|
11
|
-
azure/quantum/_client/__init__.py,sha256=
|
|
12
|
-
azure/quantum/_client/_client.py,sha256=
|
|
13
|
-
azure/quantum/_client/_configuration.py,sha256=
|
|
11
|
+
azure/quantum/_client/__init__.py,sha256=P3K9ffYchHhHjJhCEAEwutSD3xRW92XDUQNYDjwhYqI,1056
|
|
12
|
+
azure/quantum/_client/_client.py,sha256=Zjqakj3NvRXXlSMi7S1LtJuWkhsNRFhlmCaJGwB6K-U,6616
|
|
13
|
+
azure/quantum/_client/_configuration.py,sha256=FFUHJPp6X0015GpD-YLmYCoq8GI86nHCnDS_THTSHbg,4184
|
|
14
|
+
azure/quantum/_client/_model_base.py,sha256=hu7OdRS2Ra1igfBo-R3zS3dzO3YhFC4FGHJ_WiyZgNg,43736
|
|
14
15
|
azure/quantum/_client/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
15
|
-
azure/quantum/_client/_serialization.py,sha256=
|
|
16
|
-
azure/quantum/_client/
|
|
17
|
-
azure/quantum/_client/_version.py,sha256=F0YbQe6fSn3R7WcAgLAUKAmqrPtlBZP4zCWz1Rfn3EE,495
|
|
16
|
+
azure/quantum/_client/_serialization.py,sha256=bBl0y0mh-0sDd-Z8_dj921jQQhqhYWTOl59qSLuk01M,86686
|
|
17
|
+
azure/quantum/_client/_version.py,sha256=0viF8rvxQfMuUiNz8-HmNc-M5F1PxSOl_OE0wY2QshQ,500
|
|
18
18
|
azure/quantum/_client/py.typed,sha256=dcrsqJrcYfTX-ckLFJMTaj6mD8aDe2u0tkQG-ZYxnEg,26
|
|
19
|
-
azure/quantum/_client/
|
|
20
|
-
azure/quantum/_client/
|
|
21
|
-
azure/quantum/_client/
|
|
19
|
+
azure/quantum/_client/aio/__init__.py,sha256=JB_qjKGBP8bCqOAYlToDikL3nF9rCnIsq2lf0OSP-kw,1000
|
|
20
|
+
azure/quantum/_client/aio/_client.py,sha256=Gr-PssuXfSxcktOjl0Q0F9hyXN2wZhK6ceqSuUMgQ0M,6787
|
|
21
|
+
azure/quantum/_client/aio/_configuration.py,sha256=ScmA9JAeiqzUBbrAF_x7hWLRPZKb2JWChvJf-iB6_uE,4227
|
|
22
|
+
azure/quantum/_client/aio/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
23
|
+
azure/quantum/_client/aio/operations/__init__.py,sha256=YsursegE17FYuBSlfxPdHzpx8zbfh9C9TTtEBKCGVEk,1392
|
|
24
|
+
azure/quantum/_client/aio/operations/_operations.py,sha256=q8Tu_TDAhSILRrkPUrboeyIsrVnkeOtsJJ5tqYUF2VQ,78287
|
|
25
|
+
azure/quantum/_client/aio/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
26
|
+
azure/quantum/_client/models/__init__.py,sha256=MR2av7s_tCP66hicN9JXCmTngJ4_-ozM4cmblGjPwn8,1971
|
|
27
|
+
azure/quantum/_client/models/_enums.py,sha256=RNCPXxeae4d7wtPqcSxu5JZBLFLZZYVZbALjui_f1fM,4288
|
|
28
|
+
azure/quantum/_client/models/_models.py,sha256=w208Pgf3mWVKW6FrbvPzFvPu9mY04bj763vwpo49N38,29613
|
|
22
29
|
azure/quantum/_client/models/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
23
|
-
azure/quantum/_client/operations/__init__.py,sha256=
|
|
24
|
-
azure/quantum/_client/operations/_operations.py,sha256=
|
|
30
|
+
azure/quantum/_client/operations/__init__.py,sha256=YsursegE17FYuBSlfxPdHzpx8zbfh9C9TTtEBKCGVEk,1392
|
|
31
|
+
azure/quantum/_client/operations/_operations.py,sha256=EL4c4l1t6VwdIay8_V2PomXYdF-MjG_PDSjQKwTQHfI,99639
|
|
25
32
|
azure/quantum/_client/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
26
33
|
azure/quantum/argument_types/__init__.py,sha256=AEDyuUMipR2za248GrRzqxfzr0Ysd8tj2F0OQBSFKWg,255
|
|
27
34
|
azure/quantum/argument_types/types.py,sha256=2mM8s37DKgNfSsjzwmg4dnmj9roSeHY1ZT5vKnpjAYM,1041
|
|
@@ -67,7 +74,7 @@ azure/quantum/target/pasqal/target.py,sha256=K_vqavov6gvS84voRKeBx9pO8g4LrtWrlZ5
|
|
|
67
74
|
azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
|
|
68
75
|
azure/quantum/target/rigetti/result.py,sha256=65mtAZxfdNrTWNjWPqgfwt2BZN6Nllo4g_bls7-Nm68,2334
|
|
69
76
|
azure/quantum/target/rigetti/target.py,sha256=Gw6-Km8t8nZ1aGPSgVOVi3o-bsPeQMk9P2qPqxiGAHE,7580
|
|
70
|
-
azure_quantum-2.
|
|
71
|
-
azure_quantum-2.
|
|
72
|
-
azure_quantum-2.
|
|
73
|
-
azure_quantum-2.
|
|
77
|
+
azure_quantum-2.5.0.dev0.dist-info/METADATA,sha256=G9-niU9sglY-NXtYHP_XhMxzr0or4N-NR_iY3KHnGL8,7362
|
|
78
|
+
azure_quantum-2.5.0.dev0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
79
|
+
azure_quantum-2.5.0.dev0.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
|
80
|
+
azure_quantum-2.5.0.dev0.dist-info/RECORD,,
|
azure/quantum/_client/_vendor.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
5
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
-
# --------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
from typing import List, cast
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def _format_url_section(template, **kwargs):
|
|
12
|
-
components = template.split("/")
|
|
13
|
-
while components:
|
|
14
|
-
try:
|
|
15
|
-
return template.format(**kwargs)
|
|
16
|
-
except KeyError as key:
|
|
17
|
-
# Need the cast, as for some reasons "split" is typed as list[str | Any]
|
|
18
|
-
formatted_components = cast(List[str], template.split("/"))
|
|
19
|
-
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
|
|
20
|
-
template = "/".join(components)
|
|
File without changes
|
|
File without changes
|