Skip to content

Commit bc2c657

Browse files
committed
add name to promises to log in errors
1 parent 87629c1 commit bc2c657

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

scitran_client/flywheel_analyzer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ def done(f):
260260
except (ShuttingDownException, CancelledError):
261261
pass
262262
except Exception:
263+
print('error with {}'.format(f.name))
263264
traceback.print_exc()
264265

265266
for future in futures:
@@ -340,10 +341,11 @@ def run(operations, project=None, max_workers=10, session_limit=None):
340341
sessions = sessions[:session_limit]
341342

342343
with ThreadPoolExecutor(max_workers=max_workers) as executor:
343-
futures = [
344-
executor.submit(_analyze_session, operations, gears_by_name, session)
345-
for session in sessions
346-
]
344+
futures = []
345+
for session in sessions:
346+
f = executor.submit(_analyze_session, operations, gears_by_name, session)
347+
f.name = 'session {}'.format(session['_id'])
348+
futures.append(f)
347349
_wait_for_futures(futures)
348350

349351

0 commit comments

Comments
 (0)