yellowdog-sdk 9.0.0__py3-none-any.whl → 9.1.0__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.
@@ -1,2 +1,2 @@
1
1
 
2
- __version__ = '9.0.0' # YEL-13232
2
+ __version__ = '9.1.0' # YEL-13162
@@ -6,7 +6,8 @@ from typing import List
6
6
  from .work_requirement_helper import WorkRequirementHelper
7
7
  from yellowdog_client.common import Closeable, SearchClient
8
8
  from yellowdog_client.common.server_sent_events import SubscriptionEventListener
9
- from yellowdog_client.model import Slice, SliceReference, Task, TaskGroup, TaskSearch, WorkRequirement, WorkRequirementSearch, WorkRequirementSummary
9
+ from yellowdog_client.model import Slice, SliceReference, Task, TaskGroup, TaskSearch, WorkRequirement, \
10
+ WorkRequirementSearch, WorkRequirementSummary
10
11
 
11
12
 
12
13
  class WorkClient(ABC, Closeable):
@@ -113,29 +114,32 @@ class WorkClient(ABC, Closeable):
113
114
  pass
114
115
 
115
116
  @abstractmethod
116
- def cancel_work_requirement(self, work_requirement: WorkRequirement) -> WorkRequirement:
117
+ def cancel_work_requirement(self, work_requirement: WorkRequirement, abort: bool = False) -> WorkRequirement:
117
118
  """
118
119
  Instructs the Scheduler to cancel the supplied work requirement, no further tasks will be executed and all workers shall be released.
119
120
 
120
121
  :param work_requirement: the work requirement to cancel
122
+ :param abort: if tasks should be aborted if they have been allocated to a worker
121
123
  :return: the latest state of the work requirement after the cancel instruction was submitted
122
124
  """
123
125
 
124
126
  pass
125
127
 
126
128
  @abstractmethod
127
- def cancel_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
129
+ def cancel_work_requirement_by_id(self, work_requirement_id: str, abort: bool = False) -> WorkRequirement:
128
130
  """
129
131
  Instructs the Scheduler to cancel the supplied work requirement, no further tasks will be executed and all workers shall be released.
130
132
 
131
133
  :param work_requirement_id: the ID of the work requirement to cancel
134
+ :param abort: if tasks should be aborted if they have been allocated to a worker
132
135
  :return: the latest state of the work requirement after the cancel instruction was submitted
133
136
  """
134
137
 
135
138
  pass
136
139
 
137
140
  @abstractmethod
138
- def add_work_requirement_listener(self, work_requirement: WorkRequirement, listener: SubscriptionEventListener[WorkRequirement]) -> None:
141
+ def add_work_requirement_listener(self, work_requirement: WorkRequirement,
142
+ listener: SubscriptionEventListener[WorkRequirement]) -> None:
139
143
  """
140
144
  Adds an event listener to receive notifications of changes for the specified work requirement.
141
145
  The client manages subscriptions to YellowDog Scheduler such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.
@@ -147,7 +151,8 @@ class WorkClient(ABC, Closeable):
147
151
  pass
148
152
 
149
153
  @abstractmethod
150
- def add_work_requirement_listener_by_id(self, work_requirement_id: str, listener: SubscriptionEventListener[WorkRequirement]) -> None:
154
+ def add_work_requirement_listener_by_id(self, work_requirement_id: str,
155
+ listener: SubscriptionEventListener[WorkRequirement]) -> None:
151
156
  """
152
157
  Adds an event listener to receive notifications of changes for the specified work requirement.
153
158
  The client manages subscriptions to YellowDog Scheduler such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.
@@ -238,7 +243,8 @@ class WorkClient(ABC, Closeable):
238
243
  pass
239
244
 
240
245
  @abstractmethod
241
- def add_tasks_to_task_group_by_name(self, namespace: str, work_requirement_name: str, task_group_name: str, tasks: List[Task]) -> List[Task]:
246
+ def add_tasks_to_task_group_by_name(self, namespace: str, work_requirement_name: str, task_group_name: str,
247
+ tasks: List[Task]) -> List[Task]:
242
248
  """
243
249
  Submits NEW tasks to the YellowDog Scheduler service to be added to the specified task group.
244
250
 
@@ -58,19 +58,19 @@ class WorkClientImpl(WorkClient):
58
58
  return self.hold_work_requirement_by_id(work_requirement.id)
59
59
 
60
60
  def hold_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
61
- return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.HELD)
61
+ return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.HELD, False)
62
62
 
63
63
  def start_work_requirement(self, work_requirement: WorkRequirement) -> WorkRequirement:
64
64
  return self.start_work_requirement_by_id(work_requirement.id)
65
65
 
66
66
  def start_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
67
- return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.RUNNING)
67
+ return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.RUNNING, False)
68
68
 
69
- def cancel_work_requirement(self, work_requirement: WorkRequirement) -> WorkRequirement:
70
- return self.cancel_work_requirement_by_id(work_requirement.id)
69
+ def cancel_work_requirement(self, work_requirement: WorkRequirement, abort: bool = False) -> WorkRequirement:
70
+ return self.cancel_work_requirement_by_id(work_requirement.id, abort)
71
71
 
72
- def cancel_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
73
- return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.CANCELLING)
72
+ def cancel_work_requirement_by_id(self, work_requirement_id: str, abort: bool = False) -> WorkRequirement:
73
+ return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.CANCELLING, abort)
74
74
 
75
75
  def find_all_work_requirements(self) -> List[WorkRequirementSummary]:
76
76
  search = WorkRequirementSearch()
@@ -23,9 +23,13 @@ class WorkServiceProxy:
23
23
  def get_work_requirement_by_name(self, namespace: str, work_requirement_name: str) -> WorkRequirement:
24
24
  return self._proxy.get(WorkRequirement, "namespaces/%s/requirements/%s" % (namespace, work_requirement_name))
25
25
 
26
- def transition_work_requirement(self, requirement_id: str,
27
- next_status: WorkRequirementStatus) -> WorkRequirement:
28
- url = "requirements/%s/transition/%s" % (requirement_id, str(next_status))
26
+ def transition_work_requirement(
27
+ self,
28
+ requirement_id: str,
29
+ next_status: WorkRequirementStatus,
30
+ abort_if_cancelling: bool
31
+ ) -> WorkRequirement:
32
+ url = "requirements/%s/transition/%s?abort=%s" % (requirement_id, str(next_status), abort_if_cancelling)
29
33
  return self._proxy.put(WorkRequirement, url=url)
30
34
 
31
35
  def find_work_requirements(self, search: WorkRequirementSearch, slice_reference: SliceReference) -> Slice[WorkRequirementSummary]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-sdk
3
- Version: 9.0.0
3
+ Version: 9.1.0
4
4
  Summary: SDK for the YellowDog Platform
5
5
  Author-email: YellowDog Limited <support@yellowdog.co>
6
6
  Project-URL: Homepage, https://yellowdog.co
@@ -1,6 +1,6 @@
1
1
  __init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  yellowdog_client/__init__.py,sha256=xHGTw5UbjkeEl_hC8_gJCacfji6462qJWD1nvJdFssE,13162
3
- yellowdog_client/_version.py,sha256=Tc6oNDQwE6Y33AlkRryK323IehSzbGk8uYLYAjFNngo,35
3
+ yellowdog_client/_version.py,sha256=ZtjrQEtRl5TaX372gylcG8I4Aa_86zEsky-HhcgfcxQ,35
4
4
  yellowdog_client/client_collection.py,sha256=VSEzjf6iR1qCQ0YGLyDq_Kgvw8r832QDwTp6-MLB4Vs,388
5
5
  yellowdog_client/platform_client.py,sha256=h_9sd35e0GMdVGjSjG0KGcG3w1qLGY1Vf1U1gSor-HE,7052
6
6
  yellowdog_client/account/__init__.py,sha256=wx5GbsoODMdXbOmRoNZu5VYgDJX-RqsFb9ph14HXoV4,235
@@ -445,10 +445,10 @@ yellowdog_client/object_store/utils/memory_mapped_file_writter.py,sha256=8l9E_m8
445
445
  yellowdog_client/scheduler/__init__.py,sha256=ZORtc_LUBoTcplpoDhCHZNannI3qjeohghNcoBYU3ts,927
446
446
  yellowdog_client/scheduler/predicated_work_subscription_event_listener.py,sha256=mLfaVRmIMtQbj9u6d8O_B-VaZxOy5l1kuGCfTsS_xPU,2056
447
447
  yellowdog_client/scheduler/predicated_worker_pool_subscription_event_listener.py,sha256=z7tCniTF8WL6HSV7QcMOWFvC9EGSRopBGLODFOQinTA,2080
448
- yellowdog_client/scheduler/work_client.py,sha256=Z0bz-SvjMiTDQ-fhGW3dSHTQrgipORJqPpDRDYiw98g,12792
449
- yellowdog_client/scheduler/work_client_impl.py,sha256=Pi8r7A8nvi6NUZUHlXXyV1IMxi3H4SaBNjvV1oHM3FU,7273
448
+ yellowdog_client/scheduler/work_client.py,sha256=vaF2lWLtJkd5D16GGYUfde3nv7A5w4BcwxtacjrvNtg,13140
449
+ yellowdog_client/scheduler/work_client_impl.py,sha256=33O8T25bV-zHx3R3gSQ047NGuSmpWESn7sCaZmqgLFo,7343
450
450
  yellowdog_client/scheduler/work_requirement_helper.py,sha256=vQMoI9emTMKLLmZSil3IGNUtxUl50MFuITJTv5Okvlo,4167
451
- yellowdog_client/scheduler/work_service_proxy.py,sha256=ds0qiYHiOq9hdInjt1ynWE4GtifZlJEeh5HVDbKtTGc,2920
451
+ yellowdog_client/scheduler/work_service_proxy.py,sha256=bSg0892B82uAN3zXSUGoSF0BjVzhTuzuZNEMS-wZRIw,2995
452
452
  yellowdog_client/scheduler/worker_pool_client.py,sha256=FIFoXu0COUW_GBATqfWoZpxrOHLjLbVlWMEw5JaR5vg,15430
453
453
  yellowdog_client/scheduler/worker_pool_client_impl.py,sha256=KdDMGFfBqBAIh1HFik__0GNoIYI1dBRNwF-e9H2h9c0,8913
454
454
  yellowdog_client/scheduler/worker_pool_helper.py,sha256=TZWm4x5S4atmjvZjgt7xhx8hcsnGI087WJrqllJDK-U,1340
@@ -457,8 +457,8 @@ yellowdog_client/usage/__init__.py,sha256=XQwRJqTdxKZa1QUTsxBEL0TqQJeQHGyPklFeqc
457
457
  yellowdog_client/usage/allowances_client.py,sha256=H6n63jXjT4OwuWJgFUXSjSmvGTZz9uspy3kj3upinaA,1337
458
458
  yellowdog_client/usage/allowances_client_impl.py,sha256=nQPnSzJKhL3WvyCn5fmiDkwE84xZryH9YvV5Z1GjU4M,2061
459
459
  yellowdog_client/usage/allowances_service_proxy.py,sha256=uO6LWnpjIzUcZTGdOxPXn7SyYX7NMRqO5KUiHUGr490,1320
460
- yellowdog_sdk-9.0.0.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
461
- yellowdog_sdk-9.0.0.dist-info/METADATA,sha256=7mjzdxZu7PzlMxa6AYS5nhVjT_rpGhU0to7W-Q6mabs,3238
462
- yellowdog_sdk-9.0.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
463
- yellowdog_sdk-9.0.0.dist-info/top_level.txt,sha256=6PH16DcoqpYHhQ5A0UJOjf0tg-1rTrNC9C2CLqCMuFo,26
464
- yellowdog_sdk-9.0.0.dist-info/RECORD,,
460
+ yellowdog_sdk-9.1.0.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
461
+ yellowdog_sdk-9.1.0.dist-info/METADATA,sha256=sOSorct_Lyjcm-h5sOYoCYofMMLwfhXbV-ibFQDkpxg,3238
462
+ yellowdog_sdk-9.1.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
463
+ yellowdog_sdk-9.1.0.dist-info/top_level.txt,sha256=6PH16DcoqpYHhQ5A0UJOjf0tg-1rTrNC9C2CLqCMuFo,26
464
+ yellowdog_sdk-9.1.0.dist-info/RECORD,,