Skip to content

Commit 8be6fda

Browse files
authored
[PLT-1982] Deprecated wait_until_done (#1913)
1 parent 63b136a commit 8be6fda

File tree

5 files changed

+34
-10
lines changed

5 files changed

+34
-10
lines changed

libs/labelbox/src/labelbox/schema/annotation_import.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Union,
1515
cast,
1616
)
17+
import warnings
1718

1819
import requests
1920
from google.api_core import retry
@@ -72,7 +73,7 @@ def errors(self) -> List[Dict[str, Any]]:
7273
See `AnnotationImport.statuses` for more details.
7374
* This information will expire after 24 hours.
7475
"""
75-
self.wait_until_done()
76+
self.wait_till_done()
7677
return self._fetch_remote_ndjson(self.error_file_url)
7778

7879
@property
@@ -101,15 +102,20 @@ def statuses(self) -> List[Dict[str, Any]]:
101102
102103
* This information will expire after 24 hours.
103104
"""
104-
self.wait_until_done()
105+
self.wait_till_done()
105106
return self._fetch_remote_ndjson(self.status_file_url)
106107

107-
def wait_till_done(
108+
def wait_until_done(
108109
self, sleep_time_seconds: int = 10, show_progress: bool = False
109110
) -> None:
110-
self.wait_until_done(sleep_time_seconds, show_progress)
111+
warnings.warn(
112+
"The method wait_until_done for AnnotationImport is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
113+
DeprecationWarning,
114+
stacklevel=2,
115+
)
116+
self.wait_till_done(sleep_time_seconds, show_progress)
111117

112-
def wait_until_done(
118+
def wait_till_done(
113119
self, sleep_time_seconds: int = 10, show_progress: bool = False
114120
) -> None:
115121
"""Blocks import job until certain conditions are met.

libs/labelbox/src/labelbox/schema/create_batches_task.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from typing import TYPE_CHECKING, Callable, List, Optional, Dict, Any
3+
import warnings
34

45
from labelbox.orm.model import Entity
56

@@ -23,6 +24,11 @@ def __init__(
2324
]
2425

2526
def wait_until_done(self, timeout_seconds: int = 300) -> None:
27+
warnings.warn(
28+
"The method wait_until_done for CreateBatchesTask is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
29+
DeprecationWarning,
30+
stacklevel=2,
31+
)
2632
self.wait_till_done(timeout_seconds)
2733

2834
def wait_till_done(self, timeout_seconds: int = 300) -> None:

libs/labelbox/src/labelbox/schema/export_task.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
TypeVar,
1717
Union,
1818
)
19+
import warnings
1920

2021
import requests
2122
from pydantic import BaseModel
@@ -484,6 +485,11 @@ def organization(self):
484485
return self._task.organization
485486

486487
def wait_until_done(self, timeout_seconds: int = 7200) -> None:
488+
warnings.warn(
489+
"The method wait_until_done for ExportTask is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
490+
DeprecationWarning,
491+
stacklevel=2,
492+
)
487493
self.wait_till_done(timeout_seconds)
488494

489495
def wait_till_done(self, timeout_seconds: int = 7200) -> None:

libs/labelbox/src/labelbox/schema/model_run.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _upsert_labels_by_label_ids(
119119
MEALabelRegistrationTaskStatus(where: $where) {status errorMessage}
120120
}
121121
"""
122-
return self._wait_until_done(
122+
return self._wait_till_done(
123123
lambda: self.client.execute(
124124
status_query_str, {"where": {"id": task_id}}
125125
)["MEALabelRegistrationTaskStatus"],
@@ -144,7 +144,7 @@ def _upsert_labels_by_project_id(
144144
MEALabelRegistrationTaskStatus(where: $where) {status errorMessage}
145145
}
146146
"""
147-
return self._wait_until_done(
147+
return self._wait_till_done(
148148
lambda: self.client.execute(
149149
status_query_str, {"where": {"id": task_id}}
150150
)["MEALabelRegistrationTaskStatus"],
@@ -182,14 +182,14 @@ def upsert_data_rows(
182182
MEADataRowRegistrationTaskStatus(where: $where) {status errorMessage}
183183
}
184184
"""
185-
return self._wait_until_done(
185+
return self._wait_till_done(
186186
lambda: self.client.execute(
187187
status_query_str, {"where": {"id": task_id}}
188188
)["MEADataRowRegistrationTaskStatus"],
189189
timeout_seconds=timeout_seconds,
190190
)
191191

192-
def _wait_until_done(self, status_fn, timeout_seconds=120, sleep_time=5):
192+
def _wait_till_done(self, status_fn, timeout_seconds=120, sleep_time=5):
193193
# Do not use this function outside of the scope of upsert_data_rows or upsert_labels. It could change.
194194
original_timeout = timeout_seconds
195195
while True:
@@ -419,7 +419,7 @@ def assign_data_rows_to_split(
419419
assignDataRowsToDataSplitTaskStatus(where: {id : $id}){status errorMessage}}
420420
"""
421421

422-
return self._wait_until_done(
422+
return self._wait_till_done(
423423
lambda: self.client.execute(
424424
status_query_str, {"id": task_id}, experimental=True
425425
)["assignDataRowsToDataSplitTaskStatus"],

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33
import time
44
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union
5+
import warnings
56

67
import requests
78
from lbox.exceptions import ResourceNotFoundError
@@ -92,6 +93,11 @@ def has_errors(self) -> bool:
9293
def wait_until_done(
9394
self, timeout_seconds: float = 300.0, check_frequency: float = 2.0
9495
) -> None:
96+
warnings.warn(
97+
"The method wait_until_done for Task is deprecated and will be removed in the next major release. Use the wait_till_done method instead.",
98+
DeprecationWarning,
99+
stacklevel=2,
100+
)
95101
self.wait_till_done(timeout_seconds, check_frequency)
96102

97103
def wait_till_done(

0 commit comments

Comments
 (0)