yellowdog-sdk 11.2.0__py3-none-any.whl → 11.3.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 +1 @@
1
- __version__ = '11.2.0' # YEL-13439
1
+ __version__ = '11.3.0' # YEL-13745
@@ -1,12 +1,14 @@
1
1
  from dataclasses import dataclass, asdict
2
+ from datetime import datetime, timedelta
2
3
  from typing import TypeVar, Type, Dict, Optional
3
4
 
4
5
  from requests import Request, Session, Response, HTTPError
5
6
  from requests.adapters import HTTPAdapter
6
7
  from urllib3.util.retry import Retry
7
- from yellowdog_client.model.exceptions import BaseCustomException
8
8
 
9
+ from yellowdog_client.model.exceptions import BaseCustomException
9
10
  from .credentials import ApiKeyAuthenticationHeadersProvider
11
+ from .iso_datetime import iso_timedelta_format, iso_format
10
12
  from .json import Json
11
13
  from .server_sent_events.sse4python import EventSource
12
14
  from .user_agent import UserAgent
@@ -56,6 +58,12 @@ class Proxy:
56
58
 
57
59
  def execute(self, method: str, url: str = "", data: object = None, return_type: Type[T] = None,
58
60
  params: Dict[str, object] = None) -> T:
61
+ if params is not None:
62
+ for key, value in params.items():
63
+ if isinstance(value, datetime):
64
+ params[key] = iso_format(value)
65
+ elif isinstance(value, timedelta):
66
+ params[key] = iso_timedelta_format(value)
59
67
  response = self.raw_execute(method, url, Json.dump(data) if data else None, params)
60
68
  return Json.load(response.json(), return_type) if return_type else None
61
69
 
@@ -8,33 +8,36 @@ class TaskGroupStatus(Enum):
8
8
  The status of the task group provides an aggregated view of the statuses of tasks within the task group.
9
9
  """
10
10
 
11
- PENDING = "PENDING", False, False
11
+ PENDING = "PENDING", False, False, False
12
12
  """The task group is awaiting resources required to execute tasks."""
13
- RUNNING = "RUNNING", False, False
13
+ RUNNING = "RUNNING", False, False, True
14
14
  """The task group has sufficient resources to execute tasks."""
15
- HELD = "HELD", False, False
15
+ HELD = "HELD", False, False, False
16
16
  """
17
17
  The task group parent work requirement has been held by the user such that no further tasks are executed.
18
18
  Resources (e.g. Workers) will be released.
19
19
  The task group will remain in HELD state until the user reactivates the parent work requirement.
20
20
  """
21
21
 
22
- COMPLETED = "COMPLETED", False, True
22
+ FINISHING = "FINISHING", True, False, True
23
+ """The task group is waiting for all tasks to finish, no further tasks can be added."""
24
+ COMPLETED = "COMPLETED", False, True, False
23
25
  """All tasks within the task group have been completed."""
24
- FAILING = "FAILING", True, False
26
+ FAILING = "FAILING", True, False, False
25
27
  """At least one task in the task group has failed and the task group is in the process of discarding any outstanding tasks."""
26
- FAILED = "FAILED", False, True
28
+ FAILED = "FAILED", False, True, False
27
29
  """All tasks within the task group have been finished but at least one has failed."""
28
- CANCELLING = "CANCELLING", True, False
30
+ CANCELLING = "CANCELLING", True, False, False
29
31
  """The parent work requirement is in the process of being cancelled, no further tasks will be executed."""
30
- CANCELLED = "CANCELLED", False, True
32
+ CANCELLED = "CANCELLED", False, True, False
31
33
  """The parent work requirement has been cancelled, no tasks are currently being executed or will be executed."""
32
34
 
33
- def __new__(cls, value, finishing: bool, finished: bool):
35
+ def __new__(cls, value, finishing: bool, finished: bool, active: bool):
34
36
  obj = object.__new__(cls)
35
37
  obj._value_ = value
36
38
  obj.finishing = finishing
37
39
  obj.finished = finished
40
+ obj.active = active
38
41
  return obj
39
42
 
40
43
  def __str__(self) -> str:
@@ -16,6 +16,8 @@ class WorkRequirementStatus(Enum):
16
16
  Task group resources (e.g. Workers) will be released.
17
17
  """
18
18
 
19
+ FINISHING = "FINISHING", False
20
+ """The work requirement is waiting for all tasks to finish, no further tasks can be added."""
19
21
  COMPLETED = "COMPLETED", True
20
22
  """All task groups in the work requirement have been completed."""
21
23
  FAILED = "FAILED", True
@@ -112,6 +112,28 @@ class WorkClient(ABC, Closeable):
112
112
 
113
113
  pass
114
114
 
115
+ @abstractmethod
116
+ def finish_work_requirement(self, work_requirement: WorkRequirement) -> WorkRequirement:
117
+ """
118
+ Instructs the Scheduler not to accept further tasks for the supplied work requirement and to finish it after all tasks are finished.
119
+
120
+ :param work_requirement: the work requirement to finish
121
+ :return: the latest state of the work requirement after the finish instruction was submitted
122
+ """
123
+
124
+ pass
125
+
126
+ @abstractmethod
127
+ def finish_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
128
+ """
129
+ Instructs the Scheduler not to accept further tasks for the supplied work requirement and to finish it after all tasks are finished.
130
+
131
+ :param work_requirement_id: the ID of the work requirement to finish
132
+ :return: the latest state of the work requirement after the finish instruction was submitted
133
+ """
134
+
135
+ pass
136
+
115
137
  @abstractmethod
116
138
  def cancel_work_requirement(self, work_requirement: WorkRequirement, abort: Optional[bool] = None) -> WorkRequirement:
117
139
  """
@@ -66,6 +66,12 @@ class WorkClientImpl(WorkClient):
66
66
  def start_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
67
67
  return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.RUNNING, False)
68
68
 
69
+ def finish_work_requirement(self, work_requirement: WorkRequirement) -> WorkRequirement:
70
+ return self.finish_work_requirement_by_id(work_requirement.id)
71
+
72
+ def finish_work_requirement_by_id(self, work_requirement_id: str) -> WorkRequirement:
73
+ return self.__service_proxy.transition_work_requirement(work_requirement_id, WorkRequirementStatus.FINISHING, False)
74
+
69
75
  def cancel_work_requirement(self, work_requirement: WorkRequirement, abort: bool = False) -> WorkRequirement:
70
76
  return self.cancel_work_requirement_by_id(work_requirement.id, abort)
71
77
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yellowdog-sdk
3
- Version: 11.2.0
3
+ Version: 11.3.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=oPQnQh-UkT7GrfQR1QGShIlgZrP1oiLuHqkxGWPEPMo,35
3
+ yellowdog_client/_version.py,sha256=CXS8SfCLeWDtc1vsvubY9D5OS92b3HqcVkvLSKa_hJk,35
4
4
  yellowdog_client/client_collection.py,sha256=VSEzjf6iR1qCQ0YGLyDq_Kgvw8r832QDwTp6-MLB4Vs,388
5
5
  yellowdog_client/platform_client.py,sha256=yCzKsOQKllnfzwP9bG-JGtvOdvY7EaEQzFsgX3ERzVY,7476
6
6
  yellowdog_client/account/__init__.py,sha256=DiLL3uSMyVlAKWsncX0k5Ioc2hw87HQoEkSYO0ro0fg,456
@@ -19,7 +19,7 @@ yellowdog_client/common/closeable.py,sha256=TLRGcSWDTCQnuhVxXlPyI9BoWkmETyy9h_J2
19
19
  yellowdog_client/common/countdown_event.py,sha256=RVGuUmNQ4dSGL3TTOvrNf9A-o9qwJPLZWuYuerQj2ww,1034
20
20
  yellowdog_client/common/iso_datetime.py,sha256=Ctnm5paxH8vw0NZBvvaol0L2txgldKEW2leSDH1WyQs,640
21
21
  yellowdog_client/common/pagination.py,sha256=ISzq9TkkHEIOA-8XM1MCprbLJzkvOlKCEEVHKZaehT4,540
22
- yellowdog_client/common/proxy.py,sha256=fEfpT4YMmTxAdRQJxIMUQ8xby-hSiVbyGfd0Prs51vI,8509
22
+ yellowdog_client/common/proxy.py,sha256=0_uD7_ejXFGMydCFU7IArOsaRkErH0YtusV8p0mFu2A,8899
23
23
  yellowdog_client/common/search_client.py,sha256=CThwUhlV6g_IrCOBgoyUCjgNhMXKroqGlxdkm-YimQs,1420
24
24
  yellowdog_client/common/slice_iterator.py,sha256=Zvp6Vp4jCqet7i3m7A8SK0MYcaQWcio3nMnkQQvsH-I,1303
25
25
  yellowdog_client/common/synchronized_predicated_runner.py,sha256=b5g77hWVkbh9iJF3MM6qgYN6y8SxmVmx6hKFDjG20FQ,459
@@ -330,7 +330,7 @@ yellowdog_client/model/task_error.py,sha256=9aW_ZJ0WkQjUSbpasXBtc0Wj4iu4-70Mf3jt
330
330
  yellowdog_client/model/task_error_matcher.py,sha256=idOfRZllKDlqe8Wq2GMjEaYhLLrAmd7Hai5Dr5BJMd0,291
331
331
  yellowdog_client/model/task_error_type.py,sha256=3JDxDu8_f_eQdoB_Y1xuVW4N_leSoJAGn5OjcU4X3e0,701
332
332
  yellowdog_client/model/task_group.py,sha256=29t6oxZda_P0VtnUlzQn0o8An38cD0B4jbwGiVKIqCE,2321
333
- yellowdog_client/model/task_group_status.py,sha256=7wAEOvZzq07P_0vTP0NejmDLS-MifGWO5WLlu_5OdZg,1722
333
+ yellowdog_client/model/task_group_status.py,sha256=dNFk111vk3iTOW0mPjRwUrTn_5yTbgngmJ8Rc8jlElM,1958
334
334
  yellowdog_client/model/task_input.py,sha256=d3U32xhgHdEWtSu5uSjjsLniD9dXoNeIVsyl1BeZqlw,1975
335
335
  yellowdog_client/model/task_input_source.py,sha256=Zr_p6dT0WMdMCcS2boGxPunFIa8CJB9hFguJwV85-IA,423
336
336
  yellowdog_client/model/task_input_verification.py,sha256=NYWsdtW4anEjGlqeta3mDpDPL9XmQj-0QBvb1n41svM,477
@@ -357,7 +357,7 @@ yellowdog_client/model/waterfall_provision_strategy.py,sha256=1mAIACbWcVrsy3Bjul
357
357
  yellowdog_client/model/work_requirement.py,sha256=4-kqhjS33HEjf62Z_GjcgVxHZ4Xa5c54TR1DIDgYPuY,1714
358
358
  yellowdog_client/model/work_requirement_dashboard_summary.py,sha256=BeiBs92lS1InDuYc4yt5uuWKhoNqlfdXkk3PmyinIuc,273
359
359
  yellowdog_client/model/work_requirement_search.py,sha256=xQ6U7v7O0udd2LB79DjLzX4DqpuifIwzip7Uv17jU7Y,621
360
- yellowdog_client/model/work_requirement_status.py,sha256=w_XCB-SDBJQjHnkM28UivdA53MVaAlDk0PzUcZyZYmk,1301
360
+ yellowdog_client/model/work_requirement_status.py,sha256=JXFDJLakCmpUwv1R6j97lfU_YN7Ppb4YRvhYtWqclkA,1434
361
361
  yellowdog_client/model/work_requirement_summary.py,sha256=jEvsqI6IBykpP5_LAyoTiS5elHXfaQJ2Zj1FOwxQtMU,1374
362
362
  yellowdog_client/model/worker.py,sha256=KqUNIYwy9F-R4eY3Vk2JkZIyhERE-2CxmQe-6JgkI5Q,964
363
363
  yellowdog_client/model/worker_action.py,sha256=58HCgRGrOVIsz3aKPdwGrY51w5LQQwFlVPKBQ6808Wg,520
@@ -453,8 +453,8 @@ yellowdog_client/object_store/utils/memory_mapped_file_writter.py,sha256=8l9E_m8
453
453
  yellowdog_client/scheduler/__init__.py,sha256=ZORtc_LUBoTcplpoDhCHZNannI3qjeohghNcoBYU3ts,927
454
454
  yellowdog_client/scheduler/predicated_work_subscription_event_listener.py,sha256=mLfaVRmIMtQbj9u6d8O_B-VaZxOy5l1kuGCfTsS_xPU,2056
455
455
  yellowdog_client/scheduler/predicated_worker_pool_subscription_event_listener.py,sha256=z7tCniTF8WL6HSV7QcMOWFvC9EGSRopBGLODFOQinTA,2080
456
- yellowdog_client/scheduler/work_client.py,sha256=_IRRPJLyTI2b8Y65weEEp_o2_GHy_FJAS1OMftuwSso,13035
457
- yellowdog_client/scheduler/work_client_impl.py,sha256=33O8T25bV-zHx3R3gSQ047NGuSmpWESn7sCaZmqgLFo,7343
456
+ yellowdog_client/scheduler/work_client.py,sha256=psfLSrJoJSNtj3tGD7lRHIZsLOTmUeaP7wdvdXGolLA,13963
457
+ yellowdog_client/scheduler/work_client_impl.py,sha256=oGabaKD5vU5UzrqTTtwKlnsVXTWx8xFLheWHTm_eGkw,7724
458
458
  yellowdog_client/scheduler/work_requirement_helper.py,sha256=vQMoI9emTMKLLmZSil3IGNUtxUl50MFuITJTv5Okvlo,4167
459
459
  yellowdog_client/scheduler/work_service_proxy.py,sha256=bSg0892B82uAN3zXSUGoSF0BjVzhTuzuZNEMS-wZRIw,2995
460
460
  yellowdog_client/scheduler/worker_pool_client.py,sha256=31JATKHyDTCCIOGVQGKLB_4S-u24EwVWDsYe_K1genY,15723
@@ -465,8 +465,8 @@ yellowdog_client/usage/__init__.py,sha256=XQwRJqTdxKZa1QUTsxBEL0TqQJeQHGyPklFeqc
465
465
  yellowdog_client/usage/allowances_client.py,sha256=H6n63jXjT4OwuWJgFUXSjSmvGTZz9uspy3kj3upinaA,1337
466
466
  yellowdog_client/usage/allowances_client_impl.py,sha256=nQPnSzJKhL3WvyCn5fmiDkwE84xZryH9YvV5Z1GjU4M,2061
467
467
  yellowdog_client/usage/allowances_service_proxy.py,sha256=uO6LWnpjIzUcZTGdOxPXn7SyYX7NMRqO5KUiHUGr490,1320
468
- yellowdog_sdk-11.2.0.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
469
- yellowdog_sdk-11.2.0.dist-info/METADATA,sha256=t-q0tR_wvKo_2gzqcPKXPmboTaR7wJQYmwWwr_oeF50,3239
470
- yellowdog_sdk-11.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
471
- yellowdog_sdk-11.2.0.dist-info/top_level.txt,sha256=6PH16DcoqpYHhQ5A0UJOjf0tg-1rTrNC9C2CLqCMuFo,26
472
- yellowdog_sdk-11.2.0.dist-info/RECORD,,
468
+ yellowdog_sdk-11.3.0.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
469
+ yellowdog_sdk-11.3.0.dist-info/METADATA,sha256=TQDZiVhJNeslKlUV1Hk5zfexGjdFsB-GDsJVD5zy1II,3239
470
+ yellowdog_sdk-11.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
471
+ yellowdog_sdk-11.3.0.dist-info/top_level.txt,sha256=6PH16DcoqpYHhQ5A0UJOjf0tg-1rTrNC9C2CLqCMuFo,26
472
+ yellowdog_sdk-11.3.0.dist-info/RECORD,,