1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
from parsl import python_app
from parsl.dataflow.errors import DependencyError
@python_app
def fails():
raise ValueError("Deliberate failure")
@python_app
def depends(parent):
return 1
def test_depfail_once():
"""Test the simplest dependency failure case"""
f1 = fails()
f2 = depends(f1)
assert isinstance(f1.exception(), Exception)
assert not isinstance(f1.exception(), DependencyError)
assert isinstance(f2.exception(), DependencyError)
# check that the task ID of the failing task is mentioned
# in the DependencyError message
assert ("task " + str(f1.task_record['id'])) in str(f2.exception())
def test_depfail_chain():
"""Test that dependency failures chain"""
f1 = fails()
f2 = depends(f1)
f3 = depends(f2)
f4 = depends(f3)
assert isinstance(f1.exception(), Exception)
assert not isinstance(f1.exception(), DependencyError)
assert isinstance(f2.exception(), DependencyError)
assert isinstance(f3.exception(), DependencyError)
assert isinstance(f4.exception(), DependencyError)
def test_depfail_branches():
"""Test that dependency failures propagate in the
presence of multiple downstream tasks."""
f1 = fails()
f2 = depends(f1)
f3 = depends(f1)
assert isinstance(f1.exception(), Exception)
assert not isinstance(f1.exception(), DependencyError)
assert isinstance(f2.exception(), DependencyError)
assert isinstance(f3.exception(), DependencyError)
|