diff --git a/docs/tutorials/8-fireworks.md b/docs/tutorials/8-fireworks.md index 981f8c5d..f1ae2618 100644 --- a/docs/tutorials/8-fireworks.md +++ b/docs/tutorials/8-fireworks.md @@ -94,6 +94,16 @@ flow.update_config({"manager_config": {"_fworker": "fworker1"}}, name_filter="jo flow.update_config({"manager_config": {"_fworker": "fworker2"}}, name_filter="job2") ``` +NB: There are two ways to iterate over a `Flow`. The `iterflow` method iterates through a flow such that root nodes of the graph are always returned first. This has the benefit that the `job.output` references can always be resolved. +`Flow` also has an `__iter__` method, meaning you can write + +```py +for job_or_subflow in flow: + ... +``` + +to simply iterate through the `Flow.jobs` array. Note that `jobs` can also contain other flows. + ### Launching the Jobs As described above, convert the flow to a workflow via {obj}`flow_to_workflow` and add it to your launch pad. diff --git a/tests/core/test_flow.py b/tests/core/test_flow.py index bbba6611..2216e753 100644 --- a/tests/core/test_flow.py +++ b/tests/core/test_flow.py @@ -456,7 +456,11 @@ def test_dag_validation(): job2 = Job(add, function_args=(job1.output, 2)) job1.function_args = (job2.output, 2) flow = Flow(jobs=[job1, job2]) - with pytest.raises(ValueError): + with pytest.raises( + ValueError, + match="Job connectivity contains cycles therefore job execution order " + "cannot be determined", + ): next(flow.iterflow())