Skip to content

Commit e3bd0c8

Browse files
[PLT-51] Avoid showing "error present" warning inappropriately. (#1529)
1 parent aae0046 commit e3bd0c8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

labelbox/schema/task.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ def refresh(self) -> None:
6464
if self.is_creation_task():
6565
self.errors_url = self.result_url
6666

67+
def has_errors(self) -> bool:
68+
if self.type == "export-data-rows":
69+
# self.errors fetches the error content.
70+
# This first condition prevents us from downloading the content for v2 exports
71+
return bool(self.errors_url or self.errors)
72+
if self.is_creation_task():
73+
return bool(self.failed_data_rows)
74+
return self.status == "FAILED"
75+
6776
def wait_till_done(self,
6877
timeout_seconds: float = 300.0,
6978
check_frequency: float = 2.0) -> None:
@@ -79,9 +88,7 @@ def wait_till_done(self,
7988
"Expected check frequency to be two seconds or more")
8089
while timeout_seconds > 0:
8190
if self.status != "IN_PROGRESS":
82-
# self.errors fetches the error content.
83-
# This first condition prevents us from downloading the content for v2 exports
84-
if self.errors_url is not None or self.errors is not None:
91+
if self.has_errors():
8592
logger.warning(
8693
"There are errors present. Please look at `task.errors` for more details"
8794
)

0 commit comments

Comments
 (0)