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

Commit 5242b1f

Browse files
Update connector.py
1 parent c592465 commit 5242b1f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

labelpandas/connector.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from labelbox import Client
33
import pandas
44
from concurrent.futures import ThreadPoolExecutor, as_completed
5+
from tqdm import tqdm
56

67
def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_client:baseClient, row_data_col:str,
78
global_key_col:str="", external_id_col:str="", metadata_index:dict={}, local_files:bool=False, divider:str="///", verbose=False):
@@ -35,13 +36,15 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_cl
3536
for index, row in df.iterrows():
3637
futures.append(exc.submit(create_data_rows, lb_client, base_client, row, metadata_name_key_to_schema, metadata_schema_to_name_key, row_data_col, global_key_col, external_id_col, metadata_index, local_files, divider))
3738
if verbose:
38-
print(f'Processing data rows...')
39-
for f in as_completed(futures):
40-
if verbose:
41-
x += 1
42-
print(f"On Data Row number {x}")
43-
res = f.result()
44-
global_key_to_upload_dict[str(res["global_key"])] = res
39+
print(f'Processing data rows...')
40+
if verbose:
41+
for f in tqdm(list(as_completed(futures))):
42+
res = f.result()
43+
global_key_to_upload_dict[str(res["global_key"])] = res
44+
else:
45+
for f in as_completed(futures):
46+
res = f.result()
47+
global_key_to_upload_dict[str(res["global_key"])] = res
4548
if verbose:
4649
print(f'Generated upload list - {len(global_key_to_upload_dict)} data rows to upload')
4750
return global_key_to_upload_dict

0 commit comments

Comments
 (0)