qctrl-workflow-client 5.0.0__tar.gz → 5.0.1__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.1
2
2
  Name: qctrl-workflow-client
3
- Version: 5.0.0
3
+ Version: 5.0.1
4
4
  Summary: Q-CTRL Client
5
5
  Home-page: https://q-ctrl.com
6
6
  License: https://q-ctrl.com/terms
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "qctrl-workflow-client"
3
- version = "5.0.0"
3
+ version = "5.0.1"
4
4
  description = "Q-CTRL 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.0.0"
14
+ __version__ = "5.0.1"
15
15
 
16
16
  from .defaults import get_authenticated_client_for_product
17
17
  from .functions import (
@@ -480,13 +480,15 @@ class ApiRouter(BaseRouter):
480
480
  """
481
481
  return self.update_action_status(action)
482
482
 
483
- def get_result(self, action: Action) -> DecodedResult:
483
+ def get_result(
484
+ self, action: Action, revoke_on_interrupt: bool = True
485
+ ) -> DecodedResult:
484
486
  """
485
487
  Return the result of the action.
486
488
  """
487
- return self._fetch_action(action).result
489
+ return self._fetch_action(action, revoke_on_interrupt).result
488
490
 
489
- def _fetch_action(self, action: Action) -> Any:
491
+ def _fetch_action(self, action: Action, revoke_on_interrupt: bool = True) -> Any:
490
492
  """
491
493
  Fetch the action from the server. If the action
492
494
  has not finished, the API will be polled until it has.
@@ -497,9 +499,12 @@ class ApiRouter(BaseRouter):
497
499
  if not action.is_finished():
498
500
  try:
499
501
  action = self._poll_for_completion(action)
500
- except KeyboardInterrupt:
501
- self._revoke_action(action)
502
- action = self._poll_for_completion(action)
502
+ except KeyboardInterrupt as exc:
503
+ if revoke_on_interrupt:
504
+ self._revoke_action(action)
505
+ action = self._poll_for_completion(action)
506
+ else:
507
+ raise KeyboardInterrupt from exc
503
508
 
504
509
  if action.is_failed():
505
510
  self._settings.event_dispatch("action.failure", action=action)