Skip to content

Commit

Permalink
correctly handle failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Jarry committed Jun 19, 2024
1 parent d69c2c9 commit 2793e82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def read(fname):
'psutil',
'portalocker',
'six',
"joblib==1.3.0",
"joblib",
"tqdm"
],
extras_require={
Expand Down
22 changes: 13 additions & 9 deletions src/sfctl/custom_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,23 @@ def upload_to_native_imagestore(sesh, endpoint, abspath, basename, #pylint: disa
rel_path = os.path.normpath(os.path.relpath(root, abspath))
filecount = len(files)

if show_progress:
progressdescription = 'Uploading path: {}'.format(rel_path)
with tqdm_joblib(tqdm(desc=progressdescription, total=filecount)):
try:
if show_progress:
progressdescription = 'Uploading path: {}'.format(rel_path)
with tqdm_joblib(tqdm(desc=progressdescription, total=filecount)):
Parallel(n_jobs=jobcount)(
delayed(upload_single_file_native_imagestore)(
sesh, endpoint, basename, rel_path, single_file, root, target_timeout)
for single_file in files)
else:
Parallel(n_jobs=jobcount)(
delayed(upload_single_file_native_imagestore)(
sesh, endpoint, basename, rel_path, single_file, root, target_timeout)
for single_file in files)
else:
Parallel(n_jobs=jobcount)(
delayed(upload_single_file_native_imagestore)(
sesh, endpoint, basename, rel_path, single_file, root, target_timeout)
for single_file in files)

except Exception as e:
print(e)
raise SFCTLInternalException('Upload has timed out. Consider passing a longer '
'timeout duration.')
current_time_left = get_timeout_left(target_timeout)

if current_time_left == 0:
Expand Down

0 comments on commit 2793e82

Please sign in to comment.