Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions labelbox/schema/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,19 @@ def refresh(self) -> None:
for field in self.fields():
setattr(self, field.name, getattr(tasks[0], field.name))

def wait_till_done(self, timeout_seconds: int = 300) -> None:
def wait_till_done(self,
timeout_seconds: float = 300.0,
check_frequency: float = 2.0) -> None:
""" Waits until the task is completed. Periodically queries the server
to update the task attributes.
to update the task attributes.

Args:
timeout_seconds (float): Maximum time this method can block, in seconds. Defaults to five minutes.
"""
check_frequency = 2 # frequency of checking, in seconds
Args:
timeout_seconds (float): Maximum time this method can block, in seconds. Defaults to five minutes.
check_frequency (float): Frequency of queries to server to update the task attributes, in seconds. Defaults to two seconds. Minimal value is two seconds.
"""
if check_frequency < 2.0:
raise ValueError(
"Expected check frequency to be two seconds or more")
while timeout_seconds > 0:
if self.status != "IN_PROGRESS":
# self.errors fetches the error content.
Expand Down