Skip to content

Commit bf3592e

Browse files
author
Bihan Jiang
committed
add job status key constant and fix return for delete_annotations
1 parent 2c90645 commit bf3592e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

nucleus/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
ERROR_PAYLOAD,
8888
ERRORS_KEY,
8989
JOB_ID_KEY,
90-
JOB_STATUS_KEY,
90+
JOB_LAST_KNOWN_STATUS_KEY,
9191
JOB_TYPE_KEY,
9292
JOB_CREATION_TIME_KEY,
9393
IMAGE_KEY,
@@ -217,7 +217,7 @@ def list_jobs(
217217
return [
218218
AsyncJob(
219219
job_id=job[JOB_ID_KEY],
220-
job_last_known_status=job[JOB_STATUS_KEY],
220+
job_last_known_status=job[JOB_LAST_KNOWN_STATUS_KEY],
221221
job_type=job[JOB_TYPE_KEY],
222222
job_creation_time=job[JOB_CREATION_TIME_KEY],
223223
client=self,

nucleus/constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
ITEM_METADATA_SCHEMA_KEY = "item_metadata_schema"
4343
JOB_ID_KEY = "job_id"
4444
KEEP_HISTORY_KEY = "keep_history"
45-
JOB_STATUS_KEY = "job_last_known_status"
45+
JOB_STATUS_KEY = "job_status"
46+
JOB_LAST_KNOWN_STATUS_KEY = "job_last_known_status"
4647
JOB_TYPE_KEY = "job_type"
4748
JOB_CREATION_TIME_KEY = "job_creation_time"
4849
LABEL_KEY = "label"

nucleus/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,4 +366,4 @@ def delete_annotations(
366366
response = self._client.delete_annotations(
367367
self.id, reference_ids, keep_history
368368
)
369-
return AsyncJob(response[JOB_ID_KEY], self._client)
369+
return AsyncJob.from_json(response, self._client)

nucleus/job.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
JOB_CREATION_TIME_KEY,
77
JOB_ID_KEY,
88
JOB_STATUS_KEY,
9+
JOB_LAST_KNOWN_STATUS_KEY,
910
JOB_TYPE_KEY,
1011
)
1112

@@ -26,7 +27,7 @@ def status(self) -> Dict[str, str]:
2627
route=f"job/{self.job_id}",
2728
requests_command=requests.get,
2829
)
29-
self.job_last_known_status = response["job_status"]
30+
self.job_last_known_status = response[JOB_STATUS_KEY]
3031
return response
3132

3233
def errors(self) -> List[str]:
@@ -56,7 +57,7 @@ def sleep_until_complete(self, verbose_std_out=True):
5657
def from_json(cls, payload: dict, client):
5758
return cls(
5859
job_id=payload[JOB_ID_KEY],
59-
job_last_known_status=payload[JOB_STATUS_KEY],
60+
job_last_known_status=payload[JOB_LAST_KNOWN_STATUS_KEY],
6061
job_type=payload[JOB_TYPE_KEY],
6162
job_creation_time=payload[JOB_CREATION_TIME_KEY],
6263
client=client,

0 commit comments

Comments
 (0)