Skip to content

Commit f1b4ebc

Browse files
committed
reinstated exception catching in submitter
1 parent fd2e966 commit f1b4ebc

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

docker-scripts-for-tests/run-docker-slurm-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ else
55
fi
66

77

8-
docker exec slurm bash -c "pytest /pydra/$TEST --color=yes -vs -k 'not test_audit_prov and not test_audit_prov_messdir_1 and not test_audit_prov_messdir_2 and not test_audit_prov_wf and not test_audit_all'"
8+
docker exec slurm bash -c "pytest -vv /pydra/$TEST --color=yes -vs -k 'not test_audit_prov and not test_audit_prov_messdir_1 and not test_audit_prov_messdir_2 and not test_audit_prov_wf and not test_audit_all' $2"

pydra/engine/submitter.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -258,24 +258,24 @@ def Split(
258258
environment=environment,
259259
hooks=hooks,
260260
)
261-
# try:
262-
self.run_start_time = datetime.now()
263-
if self.worker.is_async: # Only workflow tasks can be async
264-
self.loop.run_until_complete(self.worker.run_async(task, rerun=rerun))
265-
else:
266-
self.worker.run(task, rerun=rerun)
267-
# except Exception as e:
268-
# msg = (
269-
# f"Full crash report for {type(task_def).__name__!r} task is here: "
270-
# + str(task.output_dir / "_error.pklz")
271-
# )
272-
# if raise_errors:
273-
# e.add_note(msg)
274-
# raise e
275-
# else:
276-
# logger.error("\nTask execution failed\n%s", msg)
277-
# finally:
278-
# self.run_start_time = None
261+
try:
262+
self.run_start_time = datetime.now()
263+
if self.worker.is_async: # Only workflow tasks can be async
264+
self.loop.run_until_complete(self.worker.run_async(task, rerun=rerun))
265+
else:
266+
self.worker.run(task, rerun=rerun)
267+
except Exception as e:
268+
msg = (
269+
f"Full crash report for {type(task_def).__name__!r} task is here: "
270+
+ str(task.output_dir / "_error.pklz")
271+
)
272+
if raise_errors:
273+
e.add_note(msg)
274+
raise e
275+
else:
276+
logger.error("\nTask execution failed\n%s", msg)
277+
finally:
278+
self.run_start_time = None
279279
PersistentCache().clean_up()
280280
result = task.result()
281281
if result is None:

pydra/engine/tests/test_workflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4463,7 +4463,7 @@ def OuterWf(start_number, task_name, dummy):
44634463
assert res.outputs.res2[0] == 23 and res.outputs.res2[1] == 23
44644464

44654465

4466-
def test_rerun_errored(plugin_parallel, tmp_path, capfd):
4466+
def test_rerun_errored(tmp_path, capfd):
44674467
"""Test rerunning a workflow containing errors.
44684468
Only the errored tasks and workflow should be rerun"""
44694469

@@ -4486,11 +4486,11 @@ def WorkyPassOdds(x):
44864486
print("Starting run 1")
44874487
with pytest.raises(RuntimeError):
44884488
# Must be cf to get the error from all tasks, otherwise will only get the first error
4489-
worky(worker=plugin_parallel, cache_dir=tmp_path)
4489+
worky(worker="cf", cache_dir=tmp_path)
44904490

44914491
print("Starting run 2")
44924492
with pytest.raises(RuntimeError):
4493-
worky(worker=plugin_parallel, cache_dir=tmp_path)
4493+
worky(worker="cf", cache_dir=tmp_path)
44944494

44954495
out, err = capfd.readouterr()
44964496
stdout_lines = out.splitlines()

0 commit comments

Comments
 (0)