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

Commit 5d6c2a2

Browse files
Update connector.py
1 parent 1d6b411 commit 5d6c2a2

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

labelpandas/connector.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from labelbase import Client as baseClient
22
from labelbox import Client
33
import pandas
4-
from tqdm.autonotebook import tqdm
54
from concurrent.futures import ThreadPoolExecutor, as_completed
65

76
def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_client:baseClient, row_data_col:str,
@@ -30,20 +29,17 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_cl
3029
global_key_to_upload_dict = {}
3130
futures = []
3231
with ThreadPoolExecutor() as exc:
33-
for index, row in df.iterrows():
34-
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))
3532
if verbose:
3633
print(f'Processing data rows...')
37-
x = 0
38-
for f in tqdm(as_completed(futures)):
39-
x+=1
34+
for index, row in df.iterrows():
35+
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))
36+
x = 0
37+
for f in as_completed(futures):
38+
if verbose:
39+
x += 1
4040
print(f"On Data Row number {x}")
41-
res = f.result()
42-
global_key_to_upload_dict[str(res["global_key"])] = res
43-
else:
44-
for f in as_completed(futures):
45-
res = f.result()
46-
global_key_to_upload_dict[str(res["global_key"])] = res
41+
res = f.result()
42+
global_key_to_upload_dict[str(res["global_key"])] = res
4743
if verbose:
4844
print(f'Generated upload list - {len(global_key_to_upload_dict)} data rows to upload')
4945
return global_key_to_upload_dict

0 commit comments

Comments
 (0)