Skip to content

Commit ff07661

Browse files
committed
Improve error handling
1 parent d8f81a9 commit ff07661

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

labelbox/schema/model_run.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,18 @@ def upsert_predictions_and_send_to_project(
162162
if len(mea_to_mal_data_rows) == 0:
163163
return import_job, None, None
164164

165-
batch = project.create_batch(name, mea_to_mal_data_rows, priority)
166-
mal_prediction_import = Entity.MALPredictionImport.create_for_model_run_data_rows(
167-
data_row_ids=mea_to_mal_data_rows, project_id=project_id, **kwargs)
168-
return import_job, batch, mal_prediction_import
165+
try:
166+
batch = project.create_batch(name, mea_to_mal_data_rows, priority)
167+
try:
168+
mal_prediction_import = Entity.MALPredictionImport.create_for_model_run_data_rows(
169+
data_row_ids=mea_to_mal_data_rows,
170+
project_id=project_id,
171+
**kwargs)
172+
return import_job, batch, mal_prediction_import
173+
except:
174+
return import_job, batch, None
175+
except:
176+
return import_job, None, None
169177

170178
def add_predictions(
171179
self,

0 commit comments

Comments
 (0)