Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 630bb6a

Browse files
Update connector.py
1 parent ab65603 commit 630bb6a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

labelpandas/connector.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_cl
4040
print(f'Processing data rows...')
4141
for f in tqdm(as_completed(futures)):
4242
res = f.result()
43-
if type(res)==dict:
44-
global_key_to_upload_dict[str(res["global_key"])] = res
45-
else:
43+
if res['error']:
4644
failed_global_keys.append(res)
45+
else:
46+
global_key_to_upload_dict[str(res["global_key"])] = res
4747
else:
4848
for f in as_completed(futures):
4949
res = f.result()
50-
if type(res)==dict:
51-
global_key_to_upload_dict[str(res["global_key"])] = res
50+
if res['error']:
51+
failed_global_keys.append(res)
5252
else:
53-
failed_global_keys.append(res)
53+
global_key_to_upload_dict[str(res["global_key"])] = res
5454
if verbose:
5555
print(f'Generated upload list - {len(global_key_to_upload_dict)} data rows to upload')
5656
if failed_global_keys:
@@ -95,9 +95,9 @@ def create_data_rows(lb_client:Client, base_client:baseClient, row:pandas.core.s
9595
metadata_fields.append({"schema_id" : metadata_name_key_to_schema[metadata_field_name], "value" : input_metadata})
9696
else:
9797
continue
98-
return_value = {"row_data":row_data,"global_key":str(row[global_key_col]),"external_id":str(row[external_id_col]),"metadata_fields":metadata_fields}
98+
return_value = {"error" : None, "result" : {"row_data":row_data,"global_key":str(row[global_key_col]),"external_id":str(row[external_id_col]),"metadata_fields":metadata_fields}}
9999
except Exception as e:
100-
return_value = [str(row[global_key_col]), e]
100+
return_value = {"error" : e, "result" : None}
101101
return return_value
102102

103103
def get_columns_function(df):

0 commit comments

Comments
 (0)