azure-quantum 2.5.0.dev0__py3-none-any.whl → 2.5.0.dev1__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 +5 -11
- azure/quantum/_client/_client.py +49 -40
- azure/quantum/_client/_configuration.py +41 -34
- azure/quantum/_client/_serialization.py +172 -285
- azure/quantum/_client/_vendor.py +20 -0
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/_client/models/__init__.py +30 -41
- azure/quantum/_client/models/_enums.py +4 -34
- azure/quantum/_client/models/_models.py +764 -435
- azure/quantum/_client/operations/__init__.py +10 -16
- azure/quantum/_client/operations/_operations.py +772 -1194
- azure/quantum/target/microsoft/elements/dft/target.py +109 -29
- azure/quantum/target/rigetti/target.py +0 -5
- azure/quantum/version.py +1 -1
- azure/quantum/workspace.py +38 -371
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev1.dist-info}/METADATA +1 -1
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev1.dist-info}/RECORD +19 -26
- azure/quantum/_client/_model_base.py +0 -1159
- azure/quantum/_client/aio/__init__.py +0 -29
- azure/quantum/_client/aio/_client.py +0 -143
- azure/quantum/_client/aio/_configuration.py +0 -82
- azure/quantum/_client/aio/_patch.py +0 -20
- azure/quantum/_client/aio/operations/__init__.py +0 -35
- azure/quantum/_client/aio/operations/_operations.py +0 -1824
- azure/quantum/_client/aio/operations/_patch.py +0 -20
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev1.dist-info}/WHEEL +0 -0
- {azure_quantum-2.5.0.dev0.dist-info → azure_quantum-2.5.0.dev1.dist-info}/top_level.txt +0 -0
azure/quantum/workspace.py
CHANGED
|
@@ -10,7 +10,6 @@ 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
|
|
14
13
|
from typing import (
|
|
15
14
|
Any,
|
|
16
15
|
Dict,
|
|
@@ -21,9 +20,7 @@ from typing import (
|
|
|
21
20
|
Tuple,
|
|
22
21
|
Union,
|
|
23
22
|
)
|
|
24
|
-
from azure.
|
|
25
|
-
from azure.quantum._client import ServicesClient
|
|
26
|
-
from azure.quantum._client.models import JobDetails, ItemDetails, SessionDetails
|
|
23
|
+
from azure.quantum._client import QuantumClient
|
|
27
24
|
from azure.quantum._client.operations import (
|
|
28
25
|
JobsOperations,
|
|
29
26
|
StorageOperations,
|
|
@@ -52,6 +49,7 @@ from azure.quantum.storage import (
|
|
|
52
49
|
if TYPE_CHECKING:
|
|
53
50
|
from azure.quantum.target import Target
|
|
54
51
|
|
|
52
|
+
|
|
55
53
|
logger = logging.getLogger(__name__)
|
|
56
54
|
|
|
57
55
|
__all__ = ["Workspace"]
|
|
@@ -141,9 +139,6 @@ class Workspace:
|
|
|
141
139
|
|
|
142
140
|
self._connection_params = connection_params
|
|
143
141
|
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
|
|
147
142
|
|
|
148
143
|
# Create QuantumClient
|
|
149
144
|
self._client = self._create_client()
|
|
@@ -218,7 +213,7 @@ class Workspace:
|
|
|
218
213
|
"""
|
|
219
214
|
return self._storage
|
|
220
215
|
|
|
221
|
-
def _create_client(self) ->
|
|
216
|
+
def _create_client(self) -> QuantumClient:
|
|
222
217
|
""""
|
|
223
218
|
An internal method to (re)create the underlying Azure SDK REST API client.
|
|
224
219
|
|
|
@@ -229,12 +224,12 @@ class Workspace:
|
|
|
229
224
|
kwargs = {}
|
|
230
225
|
if connection_params.api_version:
|
|
231
226
|
kwargs["api_version"] = connection_params.api_version
|
|
232
|
-
client =
|
|
233
|
-
region=connection_params.location,
|
|
227
|
+
client = QuantumClient(
|
|
234
228
|
credential=connection_params.get_credential_or_default(),
|
|
235
229
|
subscription_id=connection_params.subscription_id,
|
|
236
230
|
resource_group_name=connection_params.resource_group,
|
|
237
231
|
workspace_name=connection_params.workspace_name,
|
|
232
|
+
azure_region=connection_params.location,
|
|
238
233
|
user_agent=connection_params.get_full_user_agent(),
|
|
239
234
|
credential_scopes = [ConnectionConstants.DATA_PLANE_CREDENTIAL_SCOPE],
|
|
240
235
|
endpoint=connection_params.quantum_endpoint,
|
|
@@ -357,11 +352,7 @@ class Workspace:
|
|
|
357
352
|
blob_details = BlobDetails(
|
|
358
353
|
container_name=container_name, blob_name=blob_name
|
|
359
354
|
)
|
|
360
|
-
container_uri = client.
|
|
361
|
-
self._subscription_id,
|
|
362
|
-
self._resource_group,
|
|
363
|
-
self._workspace_name,
|
|
364
|
-
blob_details=blob_details)
|
|
355
|
+
container_uri = client.sas_uri(blob_details=blob_details)
|
|
365
356
|
|
|
366
357
|
logger.debug("Container URI from service: %s", container_uri)
|
|
367
358
|
return container_uri.sas_uri
|
|
@@ -377,12 +368,8 @@ class Workspace:
|
|
|
377
368
|
:rtype: Job
|
|
378
369
|
"""
|
|
379
370
|
client = self._get_jobs_client()
|
|
380
|
-
details = client.
|
|
381
|
-
|
|
382
|
-
self._resource_group,
|
|
383
|
-
self._workspace_name,
|
|
384
|
-
job.details.id,
|
|
385
|
-
job.details
|
|
371
|
+
details = client.create(
|
|
372
|
+
job.details.id, job.details
|
|
386
373
|
)
|
|
387
374
|
return Job(self, details)
|
|
388
375
|
|
|
@@ -398,16 +385,8 @@ class Workspace:
|
|
|
398
385
|
:rtype: Job
|
|
399
386
|
"""
|
|
400
387
|
client = self._get_jobs_client()
|
|
401
|
-
client.
|
|
402
|
-
|
|
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)
|
|
388
|
+
client.cancel(job.details.id)
|
|
389
|
+
details = client.get(job.id)
|
|
411
390
|
return Job(self, details)
|
|
412
391
|
|
|
413
392
|
def get_job(self, job_id: str) -> Job:
|
|
@@ -425,11 +404,7 @@ class Workspace:
|
|
|
425
404
|
from azure.quantum.target import Target
|
|
426
405
|
|
|
427
406
|
client = self._get_jobs_client()
|
|
428
|
-
details = client.get(
|
|
429
|
-
self._subscription_id,
|
|
430
|
-
self._resource_group,
|
|
431
|
-
self._workspace_name,
|
|
432
|
-
job_id)
|
|
407
|
+
details = client.get(job_id)
|
|
433
408
|
target_factory = TargetFactory(base_cls=Target, workspace=self)
|
|
434
409
|
# pylint: disable=protected-access
|
|
435
410
|
target_cls = target_factory._target_cls(
|
|
@@ -441,14 +416,8 @@ class Workspace:
|
|
|
441
416
|
def list_jobs(
|
|
442
417
|
self,
|
|
443
418
|
name_match: Optional[str] = None,
|
|
444
|
-
|
|
445
|
-
|
|
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
|
|
419
|
+
status: Optional[JobStatus] = None,
|
|
420
|
+
created_after: Optional[datetime] = None
|
|
452
421
|
) -> List[Job]:
|
|
453
422
|
"""
|
|
454
423
|
Returns list of jobs that meet optional (limited) filter criteria.
|
|
@@ -465,54 +434,17 @@ class Workspace:
|
|
|
465
434
|
:return: Jobs that matched the search criteria.
|
|
466
435
|
:rtype: typing.List[Job]
|
|
467
436
|
"""
|
|
468
|
-
|
|
469
|
-
|
|
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)
|
|
437
|
+
client = self._get_jobs_client()
|
|
438
|
+
jobs = client.list()
|
|
478
439
|
|
|
479
440
|
result = []
|
|
480
|
-
for j in
|
|
441
|
+
for j in jobs:
|
|
481
442
|
deserialized_job = Job(self, j)
|
|
482
|
-
|
|
443
|
+
if deserialized_job.matches_filter(name_match, status, created_after):
|
|
444
|
+
result.append(deserialized_job)
|
|
483
445
|
|
|
484
446
|
return result
|
|
485
447
|
|
|
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
|
-
|
|
516
448
|
def _get_target_status(
|
|
517
449
|
self,
|
|
518
450
|
name: Optional[str] = None,
|
|
@@ -533,10 +465,7 @@ class Workspace:
|
|
|
533
465
|
"""
|
|
534
466
|
return [
|
|
535
467
|
(provider.id, target)
|
|
536
|
-
for provider in self._client.providers.
|
|
537
|
-
self._subscription_id,
|
|
538
|
-
self._resource_group,
|
|
539
|
-
self._workspace_name)
|
|
468
|
+
for provider in self._client.providers.get_status()
|
|
540
469
|
for target in provider.targets
|
|
541
470
|
if (provider_id is None or provider.id.lower() == provider_id.lower())
|
|
542
471
|
and (name is None or target.id.lower() == name.lower())
|
|
@@ -592,24 +521,10 @@ class Workspace:
|
|
|
592
521
|
:rtype: typing.List[typing.Dict[str, typing.Any]
|
|
593
522
|
"""
|
|
594
523
|
client = self._get_quotas_client()
|
|
595
|
-
return [q.as_dict() for q in client.list(
|
|
596
|
-
self._subscription_id,
|
|
597
|
-
self._resource_group,
|
|
598
|
-
self._workspace_name
|
|
599
|
-
)]
|
|
524
|
+
return [q.as_dict() for q in client.list()]
|
|
600
525
|
|
|
601
526
|
def list_top_level_items(
|
|
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
|
|
527
|
+
self
|
|
613
528
|
) -> List[Union[Job, Session]]:
|
|
614
529
|
"""
|
|
615
530
|
Get a list of top level items for the given workspace,
|
|
@@ -619,64 +534,14 @@ class Workspace:
|
|
|
619
534
|
:return: List of Workspace top level Jobs or Sessions.
|
|
620
535
|
:rtype: typing.List[typing.Union[Job, Session]]
|
|
621
536
|
"""
|
|
622
|
-
|
|
623
|
-
|
|
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
|
-
|
|
537
|
+
client = self._get_top_level_items_client()
|
|
538
|
+
item_details_list = client.list()
|
|
635
539
|
result = [WorkspaceItemFactory.__new__(workspace=self, item_details=item_details)
|
|
636
|
-
for item_details in
|
|
540
|
+
for item_details in item_details_list]
|
|
637
541
|
return result
|
|
638
542
|
|
|
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
|
-
|
|
671
543
|
def list_sessions(
|
|
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
|
|
544
|
+
self
|
|
680
545
|
) -> List[Session]:
|
|
681
546
|
"""
|
|
682
547
|
Get the list of sessions in the given workspace.
|
|
@@ -684,50 +549,11 @@ class Workspace:
|
|
|
684
549
|
:return: List of Workspace Sessions.
|
|
685
550
|
:rtype: typing.List[Session]
|
|
686
551
|
"""
|
|
687
|
-
|
|
688
|
-
|
|
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
|
-
|
|
552
|
+
client = self._get_sessions_client()
|
|
553
|
+
session_details_list = client.list()
|
|
696
554
|
result = [Session(workspace=self,details=session_details)
|
|
697
|
-
for session_details in
|
|
555
|
+
for session_details in session_details_list]
|
|
698
556
|
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)
|
|
731
557
|
|
|
732
558
|
def open_session(
|
|
733
559
|
self,
|
|
@@ -743,12 +569,9 @@ class Workspace:
|
|
|
743
569
|
:rtype: Session
|
|
744
570
|
"""
|
|
745
571
|
client = self._get_sessions_client()
|
|
746
|
-
session.details = client.
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
self._workspace_name,
|
|
750
|
-
session.id,
|
|
751
|
-
session.details)
|
|
572
|
+
session.details = client.open(
|
|
573
|
+
session_id=session.id,
|
|
574
|
+
session=session.details)
|
|
752
575
|
|
|
753
576
|
def close_session(
|
|
754
577
|
self,
|
|
@@ -764,17 +587,9 @@ class Workspace:
|
|
|
764
587
|
"""
|
|
765
588
|
client = self._get_sessions_client()
|
|
766
589
|
if not session.is_in_terminal_state():
|
|
767
|
-
session.details = client.close(
|
|
768
|
-
self._subscription_id,
|
|
769
|
-
self._resource_group,
|
|
770
|
-
self._workspace_name,
|
|
771
|
-
session_id=session.id)
|
|
590
|
+
session.details = client.close(session_id=session.id)
|
|
772
591
|
else:
|
|
773
|
-
session.details = client.get(
|
|
774
|
-
self._subscription_id,
|
|
775
|
-
self._resource_group,
|
|
776
|
-
self._workspace_name,
|
|
777
|
-
session_id=session.id)
|
|
592
|
+
session.details = client.get(session_id=session.id)
|
|
778
593
|
|
|
779
594
|
if session.target:
|
|
780
595
|
if (session.target.latest_session
|
|
@@ -808,21 +623,13 @@ class Workspace:
|
|
|
808
623
|
:rtype: Session
|
|
809
624
|
"""
|
|
810
625
|
client = self._get_sessions_client()
|
|
811
|
-
session_details = client.get(
|
|
812
|
-
self._subscription_id,
|
|
813
|
-
self._resource_group,
|
|
814
|
-
self._workspace_name,
|
|
815
|
-
session_id=session_id)
|
|
626
|
+
session_details = client.get(session_id=session_id)
|
|
816
627
|
result = Session(workspace=self, details=session_details)
|
|
817
628
|
return result
|
|
818
629
|
|
|
819
630
|
def list_session_jobs(
|
|
820
631
|
self,
|
|
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
|
|
632
|
+
session_id: str
|
|
826
633
|
) -> List[Job]:
|
|
827
634
|
"""
|
|
828
635
|
Gets all jobs associated with a session.
|
|
@@ -833,48 +640,12 @@ class Workspace:
|
|
|
833
640
|
:return: List of all jobs associated with a session.
|
|
834
641
|
:rtype: typing.List[Job]
|
|
835
642
|
"""
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
name_match=name_match,
|
|
839
|
-
status=status,
|
|
840
|
-
orderby_property=orderby_property,
|
|
841
|
-
is_asc=is_asc)
|
|
842
|
-
|
|
643
|
+
client = self._get_sessions_client()
|
|
644
|
+
job_details_list = client.jobs_list(session_id=session_id)
|
|
843
645
|
result = [Job(workspace=self, job_details=job_details)
|
|
844
|
-
for job_details in
|
|
646
|
+
for job_details in job_details_list]
|
|
845
647
|
return result
|
|
846
648
|
|
|
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
|
-
|
|
878
649
|
def get_container_uri(
|
|
879
650
|
self,
|
|
880
651
|
job_id: Optional[str] = None,
|
|
@@ -920,107 +691,3 @@ class Workspace:
|
|
|
920
691
|
self.storage, container_name
|
|
921
692
|
)
|
|
922
693
|
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,33 +2,26 @@ 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=YyuSFpZblrjgov8NDcBpYVJYDdNggolgqqQ9qPq-Rgs,240
|
|
6
|
+
azure/quantum/workspace.py,sha256=1__iZTe59ozAsAGJ4nECxmk_211Dm8ALJi-MFIdrg4o,23438
|
|
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=
|
|
14
|
-
azure/quantum/_client/_model_base.py,sha256=hu7OdRS2Ra1igfBo-R3zS3dzO3YhFC4FGHJ_WiyZgNg,43736
|
|
11
|
+
azure/quantum/_client/__init__.py,sha256=kzaVxPfnju-Y_EGMfOVYVB7pHjPvc-IWrkFI2eNk68s,896
|
|
12
|
+
azure/quantum/_client/_client.py,sha256=ZG-zalnITLyBk3BSMjLt4PtnNv8Nky5-kcmnIrk1IkQ,7143
|
|
13
|
+
azure/quantum/_client/_configuration.py,sha256=5uktKtZxoVVAoSyeL0VNGS9AfPERp-9rU5Vn30dgY7o,4440
|
|
15
14
|
azure/quantum/_client/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
16
|
-
azure/quantum/_client/_serialization.py,sha256=
|
|
17
|
-
azure/quantum/_client/
|
|
15
|
+
azure/quantum/_client/_serialization.py,sha256=KJSS6KWgnKcz-cENQCmWZ9Ziv303lnBbLwFIpYZeKFU,81097
|
|
16
|
+
azure/quantum/_client/_vendor.py,sha256=h8ByiyZ4cCQyFxqnuhTQdv1Rms3dVjKsrgZDzwMcSJ0,996
|
|
17
|
+
azure/quantum/_client/_version.py,sha256=nbzGMzOtTaGxsY-vPuiiDg_1qBemaJgyIld3CEDVTXM,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/
|
|
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
|
|
19
|
+
azure/quantum/_client/models/__init__.py,sha256=c1PRpzNsQTcDk4GkrFMMIlwNQQa2c0p5N0Lzd-23YBA,2100
|
|
20
|
+
azure/quantum/_client/models/_enums.py,sha256=omj_B8_E8ONzTHg5hLgDlFYibRRbdr9sEN298im_otA,2977
|
|
21
|
+
azure/quantum/_client/models/_models.py,sha256=wktCM5oBVfwQetNoHobL1wNsC3knXV-HmqBq_Q77Kw4,41810
|
|
29
22
|
azure/quantum/_client/models/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
30
|
-
azure/quantum/_client/operations/__init__.py,sha256=
|
|
31
|
-
azure/quantum/_client/operations/_operations.py,sha256=
|
|
23
|
+
azure/quantum/_client/operations/__init__.py,sha256=1mIl1WjHa-yFdX45TZayC1JfYeEPj5v7E2i7vck69qM,1154
|
|
24
|
+
azure/quantum/_client/operations/_operations.py,sha256=N_96-hfw6dYL3xfOI1mrYiXWAbWhNBNsV8EFpHtjW4U,81928
|
|
32
25
|
azure/quantum/_client/operations/_patch.py,sha256=YTV6yZ9bRfBBaw2z7v4MdzR-zeHkdtKkGb4SU8C25mE,694
|
|
33
26
|
azure/quantum/argument_types/__init__.py,sha256=AEDyuUMipR2za248GrRzqxfzr0Ysd8tj2F0OQBSFKWg,255
|
|
34
27
|
azure/quantum/argument_types/types.py,sha256=2mM8s37DKgNfSsjzwmg4dnmj9roSeHY1ZT5vKnpjAYM,1041
|
|
@@ -67,14 +60,14 @@ azure/quantum/target/microsoft/target.py,sha256=MlEBPhXYcHPBuORSeoslFgpw31C_cwJB
|
|
|
67
60
|
azure/quantum/target/microsoft/elements/__init__.py,sha256=gVVpaN5086iuBnajtvTjSd7MLExtnsR6RDCmcgz6xpE,70
|
|
68
61
|
azure/quantum/target/microsoft/elements/dft/__init__.py,sha256=kCXOA9HT-gb23An-A0eyktlB66VoH6EwNO4gPM97l3U,224
|
|
69
62
|
azure/quantum/target/microsoft/elements/dft/job.py,sha256=6v7lZwXyUGrOI8J17akanMrFXrPVDhsZR3c6AFpa5So,6942
|
|
70
|
-
azure/quantum/target/microsoft/elements/dft/target.py,sha256=
|
|
63
|
+
azure/quantum/target/microsoft/elements/dft/target.py,sha256=ZYWZgycwlkqg1L-YrCddykVtJm9n6CjKUOrFeQ9DdTo,12939
|
|
71
64
|
azure/quantum/target/pasqal/__init__.py,sha256=qbe6oWTQTsnTYwY3xZr32z4AWaYIchx71bYlqC2rQqw,348
|
|
72
65
|
azure/quantum/target/pasqal/result.py,sha256=SUvpnrtgvCGiepmNpyifW8b4p14-SZZ1ToCC0NAdIwg,1463
|
|
73
66
|
azure/quantum/target/pasqal/target.py,sha256=K_vqavov6gvS84voRKeBx9pO8g4LrtWrlZ5-RMLWozw,5139
|
|
74
67
|
azure/quantum/target/rigetti/__init__.py,sha256=I1vyzZBYGI540pauTqJd0RSSyTShGqkEL7Yjo25_RNY,378
|
|
75
68
|
azure/quantum/target/rigetti/result.py,sha256=65mtAZxfdNrTWNjWPqgfwt2BZN6Nllo4g_bls7-Nm68,2334
|
|
76
|
-
azure/quantum/target/rigetti/target.py,sha256=
|
|
77
|
-
azure_quantum-2.5.0.
|
|
78
|
-
azure_quantum-2.5.0.
|
|
79
|
-
azure_quantum-2.5.0.
|
|
80
|
-
azure_quantum-2.5.0.
|
|
69
|
+
azure/quantum/target/rigetti/target.py,sha256=5C8p7CVKKXsaBM0BLFA4MrBwvLtY5INp4GQsE9t4P1U,7407
|
|
70
|
+
azure_quantum-2.5.0.dev1.dist-info/METADATA,sha256=7HfGD0lISq56cWd9lJS9QWwOMmYsOZ2h4UWgUIeyu78,7362
|
|
71
|
+
azure_quantum-2.5.0.dev1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
72
|
+
azure_quantum-2.5.0.dev1.dist-info/top_level.txt,sha256=S7DhWV9m80TBzAhOFjxDUiNbKszzoThbnrSz5MpbHSQ,6
|
|
73
|
+
azure_quantum-2.5.0.dev1.dist-info/RECORD,,
|