def run_basic_healthchecks(self) -> None: """ Runs basic healthchecks on the flows contained in this Storage class """ if not hasattr(self, "_flows"): return _healthcheck.result_check(self._flows.values()) # type: ignore
def test_raises_for_checkpointed_tasks(self, kwargs): @task(**kwargs) def up(): pass f = Flow("foo-test", tasks=[up]) with pytest.raises(ValueError, match="have a result type."): healthchecks.result_check([f])
def test_raises_for_mapped_tasks_with_poorly_specified_result_location( self, tmpdir): @task(result=LocalResult(dir=tmpdir, location="{task_name}.txt")) def down(x): pass with Flow("upstream-test") as f: result = down.map(x=[1, 2, 3]) with pytest.raises(ValueError, match="filename"): healthchecks.result_check([f])
def test_raises_for_tasks_with_upstream_dependencies_with_no_result_configured( self, kwargs): @task def up(): pass @task(**kwargs, result=42) def down(x): pass with Flow("upstream-test") as f: result = down(x=up) with pytest.raises( ValueError, match="upstream dependencies do not have result types."): healthchecks.result_check([f])
def test_doesnt_raise_for_checkpointed_tasks_if_flow_has_result_handler( self, kwargs): @task(**kwargs) def up(): pass f = Flow("foo-test", tasks=[up], result_handler=42) assert healthchecks.result_check([f]) is None
def test_doesnt_raise_for_tasks_with_no_result(self, tmpdir): @task def down(x): pass with Flow("upstream-test") as f: result = down.map(x=[1, 2, 3]) assert healthchecks.result_check([f]) is None
def test_doesnt_raise_for_mapped_tasks_with_correctly_specified_result_location( self, location, tmpdir): @task(result=LocalResult(dir=tmpdir, location=location)) def down(x): pass with Flow("upstream-test") as f: result = down.map(x=[1, 2, 3]) assert healthchecks.result_check([f]) is None
def test_doesnt_raise_for_tasks_with_non_keyed_edges(self, kwargs): @task def up(): pass @task(**kwargs, result_handler=42) def down(): pass with Flow("non-keyed-test") as f: result = down(upstream_tasks=[up]) assert healthchecks.result_check([f]) is None
def test_no_raise_on_normal_flow(self): @task def up(): pass @task def down(x): pass with Flow("THIS IS A TEST") as flow: result = down(x=up, upstream_tasks=[Task(), Task()]) assert healthchecks.result_check([flow]) is None