qctrl-workflow-client 5.3.0__tar.gz → 5.4.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: qctrl-workflow-client
3
- Version: 5.3.0
3
+ Version: 5.4.0
4
4
  Summary: Q-CTRL Workflow Client
5
5
  License: https://q-ctrl.com/terms
6
6
  Keywords: black opal,boulder opal,fire opal,nisq,open controls,q control,q ctrl,q-control,q-ctrl,qcontrol,qctrl,quantum,quantum algorithms,quantum circuits,quantum coding,quantum coding software,quantum computing,quantum control,quantum control software,quantum control theory,quantum engineering,quantum error correction,quantum firmware,quantum fundamentals,quantum sensing,qubit,qudit
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "qctrl-workflow-client"
3
- version = "5.3.0"
3
+ version = "5.4.0"
4
4
  description = "Q-CTRL Workflow Client"
5
5
  license = "https://q-ctrl.com/terms"
6
6
  authors = ["Q-CTRL <support@q-ctrl.com>"]
@@ -11,7 +11,7 @@
11
11
  # distributed under the License is distributed on an "AS IS" BASIS. See the
12
12
  # License for the specific language.
13
13
 
14
- __version__ = "5.3.0"
14
+ __version__ = "5.4.0"
15
15
 
16
16
  from .defaults import get_authenticated_client_for_product
17
17
  from .functions import (
@@ -405,7 +405,7 @@ class ApiRouter(BaseRouter):
405
405
  raw_result=action_data["result"],
406
406
  errors=action_data["errors"],
407
407
  )
408
-
408
+ self._settings.event_dispatch("action.updated", action=action)
409
409
  if self._async:
410
410
  return {"async_result": action}
411
411
 
@@ -688,8 +688,45 @@ class ApiRouter(BaseRouter):
688
688
  )
689
689
  return response["tenant"]["tenant"]["currentInstances"]
690
690
 
691
+ def shut_down_machines(self) -> dict[str, Any]:
692
+ """
693
+ Shut down all the machines in the user's cloud environment.
694
+
695
+ Returns
696
+ -------
697
+ dict[str, Any]
698
+ The response from the server,
699
+ like {'terminateTenant': {'successMessage': '...', 'errors': Any}}
700
+ """
701
+ _query = gql.gql(
702
+ """
703
+ mutation terminateTenant($organizationId: ID!, $organizationSlug: String!) {
704
+ terminateTenant(
705
+ input: {organizationId: $organizationId, organizationSlug: $organizationSlug}
706
+ ) {
707
+ successMessage
708
+ errors {
709
+ fields
710
+ message
711
+ }
712
+ }
713
+ }
714
+ """
715
+ )
716
+ return self._client.execute(
717
+ _query,
718
+ {
719
+ "organizationId": self._get_configured_organization().organization_id,
720
+ "organizationSlug": self._get_configured_organization().slug,
721
+ },
722
+ )
723
+
691
724
  def activity_monitor(
692
- self, limit: int, offset: int = 0, status: Optional[str] = None
725
+ self,
726
+ limit: int,
727
+ offset: int = 0,
728
+ status: Optional[str] = None,
729
+ only_user_results: bool = True,
693
730
  ) -> list[dict[str, Any]]:
694
731
  """
695
732
  Fetch metadata from previously submitted actions.
@@ -703,6 +740,10 @@ class ApiRouter(BaseRouter):
703
740
  Defaults to 0.
704
741
  status : str or None, optional
705
742
  The filter for action status. Defaults to None.
743
+ only_user_results : bool, optional
744
+ If True, only fetch actions that belong to the user;
745
+ otherwise, fetch actions that belong to the user's organization.
746
+ Defaults to True.
706
747
 
707
748
  Returns
708
749
  -------
@@ -734,6 +775,8 @@ class ApiRouter(BaseRouter):
734
775
  check_argument(offset >= 0, "Offset must be at least 0.", {"offset": offset})
735
776
 
736
777
  filter_by = {}
778
+ if not only_user_results:
779
+ filter_by["organizationSlug"] = self._get_configured_organization().slug
737
780
  if status is not None:
738
781
  valid_statuses = [status.value for status in ActionStatus]
739
782
  check_argument(