Skip to content

Commit 8926ef4

Browse files
committed
Refactoring: replace Task.status_type with Task.status_as_enum
1 parent 6a79d46 commit 8926ef4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

libs/labelbox/src/labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ def cancel_task(self, task_id: str) -> bool:
24422442
)
24432443

24442444
# Check if task is in progress
2445-
if task.status_type != TaskStatus.In_Progress:
2445+
if task.status_as_enum != TaskStatus.In_Progress:
24462446
raise LabelboxError(
24472447
f"Task cannot be cancelled because it is not in progress. Current status: {task.status}"
24482448
)

libs/labelbox/src/labelbox/schema/task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class Task(DbObject):
4646
created_at = Field.DateTime("created_at")
4747
name = Field.String("name")
4848
status = Field.String("status")
49-
status_type = Field.Enum(
50-
TaskStatus, "status_type", "status"
49+
status_as_enum = Field.Enum(
50+
TaskStatus, "status_as_enum", "status"
5151
) # additional status for filtering
5252
completion_percentage = Field.Float("completion_percentage")
5353
result_url = Field.String("result_url", "result")

libs/labelbox/tests/data/export/streamable/test_export_data_rows_streamable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_task_filter(self, client, data_row, wait_for_data_row_processing):
148148

149149
# Check if task is listed "in progress" in organization's tasks
150150
org_tasks_in_progress = organization.tasks(
151-
where=Task.status_type == TaskStatus.In_Progress
151+
where=Task.status_as_enum == TaskStatus.In_Progress
152152
)
153153
retrieved_task_in_progress = next(
154154
(t for t in org_tasks_in_progress if t.uid == export_task.uid), ""
@@ -159,7 +159,7 @@ def test_task_filter(self, client, data_row, wait_for_data_row_processing):
159159

160160
# Check if task is listed "complete" in user's created tasks
161161
user_tasks_complete = user.created_tasks(
162-
where=Task.status_type == TaskStatus.Complete
162+
where=Task.status_as_enum == TaskStatus.Complete
163163
)
164164
retrieved_task_complete = next(
165165
(t for t in user_tasks_complete if t.uid == export_task.uid), ""

0 commit comments

Comments
 (0)