diff --git a/libs/labelbox/src/labelbox/schema/annotation_import.py b/libs/labelbox/src/labelbox/schema/annotation_import.py index c12d3b250..b445af3f5 100644 --- a/libs/labelbox/src/labelbox/schema/annotation_import.py +++ b/libs/labelbox/src/labelbox/schema/annotation_import.py @@ -14,6 +14,7 @@ Union, cast, ) +import warnings import requests from google.api_core import retry @@ -72,7 +73,7 @@ def errors(self) -> List[Dict[str, Any]]: See `AnnotationImport.statuses` for more details. * This information will expire after 24 hours. """ - self.wait_until_done() + self.wait_till_done() return self._fetch_remote_ndjson(self.error_file_url) @property @@ -101,15 +102,20 @@ def statuses(self) -> List[Dict[str, Any]]: * This information will expire after 24 hours. """ - self.wait_until_done() + self.wait_till_done() return self._fetch_remote_ndjson(self.status_file_url) - def wait_till_done( + def wait_until_done( self, sleep_time_seconds: int = 10, show_progress: bool = False ) -> None: - self.wait_until_done(sleep_time_seconds, show_progress) + warnings.warn( + "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.", + DeprecationWarning, + stacklevel=2, + ) + self.wait_till_done(sleep_time_seconds, show_progress) - def wait_until_done( + def wait_till_done( self, sleep_time_seconds: int = 10, show_progress: bool = False ) -> None: """Blocks import job until certain conditions are met. diff --git a/libs/labelbox/src/labelbox/schema/create_batches_task.py b/libs/labelbox/src/labelbox/schema/create_batches_task.py index b8770f8e8..d07a17531 100644 --- a/libs/labelbox/src/labelbox/schema/create_batches_task.py +++ b/libs/labelbox/src/labelbox/schema/create_batches_task.py @@ -1,5 +1,6 @@ import json from typing import TYPE_CHECKING, Callable, List, Optional, Dict, Any +import warnings from labelbox.orm.model import Entity @@ -23,6 +24,11 @@ def __init__( ] def wait_until_done(self, timeout_seconds: int = 300) -> None: + warnings.warn( + "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.", + DeprecationWarning, + stacklevel=2, + ) self.wait_till_done(timeout_seconds) def wait_till_done(self, timeout_seconds: int = 300) -> None: diff --git a/libs/labelbox/src/labelbox/schema/export_task.py b/libs/labelbox/src/labelbox/schema/export_task.py index 9673e42ef..2e206d433 100644 --- a/libs/labelbox/src/labelbox/schema/export_task.py +++ b/libs/labelbox/src/labelbox/schema/export_task.py @@ -16,6 +16,7 @@ TypeVar, Union, ) +import warnings import requests from pydantic import BaseModel @@ -484,6 +485,11 @@ def organization(self): return self._task.organization def wait_until_done(self, timeout_seconds: int = 7200) -> None: + warnings.warn( + "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.", + DeprecationWarning, + stacklevel=2, + ) self.wait_till_done(timeout_seconds) def wait_till_done(self, timeout_seconds: int = 7200) -> None: diff --git a/libs/labelbox/src/labelbox/schema/model_run.py b/libs/labelbox/src/labelbox/schema/model_run.py index d19107ed9..6ab816772 100644 --- a/libs/labelbox/src/labelbox/schema/model_run.py +++ b/libs/labelbox/src/labelbox/schema/model_run.py @@ -119,7 +119,7 @@ def _upsert_labels_by_label_ids( MEALabelRegistrationTaskStatus(where: $where) {status errorMessage} } """ - return self._wait_until_done( + return self._wait_till_done( lambda: self.client.execute( status_query_str, {"where": {"id": task_id}} )["MEALabelRegistrationTaskStatus"], @@ -144,7 +144,7 @@ def _upsert_labels_by_project_id( MEALabelRegistrationTaskStatus(where: $where) {status errorMessage} } """ - return self._wait_until_done( + return self._wait_till_done( lambda: self.client.execute( status_query_str, {"where": {"id": task_id}} )["MEALabelRegistrationTaskStatus"], @@ -182,14 +182,14 @@ def upsert_data_rows( MEADataRowRegistrationTaskStatus(where: $where) {status errorMessage} } """ - return self._wait_until_done( + return self._wait_till_done( lambda: self.client.execute( status_query_str, {"where": {"id": task_id}} )["MEADataRowRegistrationTaskStatus"], timeout_seconds=timeout_seconds, ) - def _wait_until_done(self, status_fn, timeout_seconds=120, sleep_time=5): + def _wait_till_done(self, status_fn, timeout_seconds=120, sleep_time=5): # Do not use this function outside of the scope of upsert_data_rows or upsert_labels. It could change. original_timeout = timeout_seconds while True: @@ -419,7 +419,7 @@ def assign_data_rows_to_split( assignDataRowsToDataSplitTaskStatus(where: {id : $id}){status errorMessage}} """ - return self._wait_until_done( + return self._wait_till_done( lambda: self.client.execute( status_query_str, {"id": task_id}, experimental=True )["assignDataRowsToDataSplitTaskStatus"], diff --git a/libs/labelbox/src/labelbox/schema/task.py b/libs/labelbox/src/labelbox/schema/task.py index f996ae05d..d536b2560 100644 --- a/libs/labelbox/src/labelbox/schema/task.py +++ b/libs/labelbox/src/labelbox/schema/task.py @@ -2,6 +2,7 @@ import logging import time from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Union +import warnings import requests from lbox.exceptions import ResourceNotFoundError @@ -92,6 +93,11 @@ def has_errors(self) -> bool: def wait_until_done( self, timeout_seconds: float = 300.0, check_frequency: float = 2.0 ) -> None: + warnings.warn( + "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.", + DeprecationWarning, + stacklevel=2, + ) self.wait_till_done(timeout_seconds, check_frequency) def wait_till_done(