scale-nucleus 0.16.1__py3-none-any.whl → 0.16.2__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.
nucleus/async_job.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import time
2
2
  from dataclasses import dataclass
3
- from typing import Dict, List
3
+ from enum import Enum
4
+ from typing import Dict, List, Set
4
5
 
5
6
  import requests
6
7
 
@@ -16,6 +17,29 @@ from nucleus.utils import replace_double_slashes
16
17
  JOB_POLLING_INTERVAL = 5
17
18
 
18
19
 
20
+ class JobStatus(str, Enum):
21
+ QUEUED = "Queued"
22
+ RUNNING = "Running"
23
+ COMPLETED = "Completed"
24
+ ERRORED_DEPRECATED = "Errored"
25
+ ERRORED_SERVER = "Errored_Server" # Server Error
26
+ ERRORED_USER = "Errored_User" # User Error
27
+ ERRORED_PARTIAL = "Errored_Partial" # Partially Completed
28
+ ERRORED_HANGING = "Errored_Hanging" # Hanging
29
+ CANCELLED = "Cancelled"
30
+ RETRIED = "Retried"
31
+
32
+
33
+ JOB_ERROR_PREFIX = JobStatus.ERRORED_DEPRECATED
34
+ JOB_ERROR_STATES: Set[JobStatus] = {
35
+ JobStatus.ERRORED_DEPRECATED,
36
+ JobStatus.ERRORED_SERVER,
37
+ JobStatus.ERRORED_USER,
38
+ JobStatus.ERRORED_PARTIAL,
39
+ JobStatus.ERRORED_HANGING,
40
+ }
41
+
42
+
19
43
  @dataclass
20
44
  class AsyncJob:
21
45
  """Object used to check the status or errors of a long running asynchronous operation.
@@ -116,7 +140,9 @@ class AsyncJob:
116
140
  f"Finished at {time.perf_counter() - start_time} s: {status}"
117
141
  )
118
142
  final_status = status
119
- if final_status["status"] == "Errored":
143
+ if final_status["status"] in JOB_ERROR_STATES or final_status[
144
+ "status"
145
+ ].startswith(JOB_ERROR_PREFIX):
120
146
  raise JobError(final_status, self)
121
147
 
122
148
  @classmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scale-nucleus
3
- Version: 0.16.1
3
+ Version: 0.16.2
4
4
  Summary: The official Python client library for Nucleus, the Data Platform for AI
5
5
  Home-page: https://scale.com/nucleus
6
6
  License: MIT
@@ -13,7 +13,7 @@ cli/tests.py,sha256=NiwEVGuF08_jlCiKEIjKhwq55NvyU4xvPEJW5MJmdZg,4590
13
13
  nucleus/__init__.py,sha256=JkJfKvNJbv-uK1wJTcgHrdsk5kroIrL_D3BCWs5gnSE,44351
14
14
  nucleus/annotation.py,sha256=hEA6nbVrKaR3ZuJpbVzdNy0bWzbzD9snjc6D_hEVtjo,42673
15
15
  nucleus/annotation_uploader.py,sha256=hv2Qr5WzwFohlWAnFG9nJ9uFHGhm4sFDl09oPssgVs0,9248
16
- nucleus/async_job.py,sha256=Y3mIiCJqWTjSi46nQhVhB5OktRhMC5HmvegdKT1q8VI,6125
16
+ nucleus/async_job.py,sha256=QX8ZAm5Q5uZsfBqZvLLRj32mW7otwJZteYGktvtSwEI,6886
17
17
  nucleus/async_utils.py,sha256=ZUlhjhxdNVZ842TJl32hRcXDkS09vR8S6jwvroZBhsA,6373
18
18
  nucleus/autocurate.py,sha256=kI0vRqad_An8SN5JX6sSdGP_vNHJI2Pq4NINHuhNf2U,1080
19
19
  nucleus/camera_params.py,sha256=fl17aaSAZDAJIWo6F2HFvM6HKGcQh9fXvo4t3RzGMc4,3726
@@ -82,8 +82,8 @@ nucleus/validate/scenario_test.py,sha256=pCmM157dblSciZCDTw-f47Fpy3OUZFgXmokdhIL
82
82
  nucleus/validate/scenario_test_evaluation.py,sha256=Q0WzaEE9uUbPVc4EHlCoKjhJcqMNt4QbyiiJx12VOR0,4075
83
83
  nucleus/validate/scenario_test_metric.py,sha256=AhVFOB1ULwBqlZ2X_Au1TXy4iQELljtzR4ZpeLB35So,1209
84
84
  nucleus/validate/utils.py,sha256=VjdIJj9Pii4z4L6xbvClAc7ra_J7cX0vWB_J2X6yrGE,185
85
- scale_nucleus-0.16.1.dist-info/LICENSE,sha256=jaTGyQSQIZeWMo5iyYqgbAYHR9Bdy7nOzgE-Up3m_-g,1075
86
- scale_nucleus-0.16.1.dist-info/METADATA,sha256=S-fzi7lqiIz7cZh_Q3osYma1RaoLxdRp0n3abO-Cllg,7822
87
- scale_nucleus-0.16.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
88
- scale_nucleus-0.16.1.dist-info/entry_points.txt,sha256=fmqEzh6NZQyg9eFMILnWabKT8OWQTMSCdDzMiVq2zYs,32
89
- scale_nucleus-0.16.1.dist-info/RECORD,,
85
+ scale_nucleus-0.16.2.dist-info/LICENSE,sha256=jaTGyQSQIZeWMo5iyYqgbAYHR9Bdy7nOzgE-Up3m_-g,1075
86
+ scale_nucleus-0.16.2.dist-info/METADATA,sha256=oQtA3lLS6aXVH3B9Jg9yzQxGF1gbPE421LNWh9S0Keo,7822
87
+ scale_nucleus-0.16.2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
88
+ scale_nucleus-0.16.2.dist-info/entry_points.txt,sha256=fmqEzh6NZQyg9eFMILnWabKT8OWQTMSCdDzMiVq2zYs,32
89
+ scale_nucleus-0.16.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.7.0
2
+ Generator: poetry-core 1.6.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any