Closed JaGeo closed 1 year ago
I know that it is probably not intended to just visualize one job but I might not be the only one that by accident passes a single job instead of a Flow.
I am closing it as the documentation clearly says it should be a Flow.
A quick fix would just be to check if it's a single Job, and if so, just wrap it with a Flow and continue just like that.
A quick fix would just be to check if it's a single Job, and if so, just wrap it with a Flow and continue just like that.
This would work if a single job in a Flow would create an output. Maybe, there is a real bug then:
from jobflow.utils.graph import to_mermaid
from jobflow import job, Flow
@job
def add(a, b):
return a + b
add_first = add(1, 2)
my_flow = Flow(jobs=[add_first])
graph_source = to_mermaid(my_flow)
print(graph_source)
produces
flowchart TD
If we remove the following line, it should work: https://github.com/materialsproject/jobflow/blob/09ffa16026b5682f7947045fedf6376ce7276d7f/src/jobflow/utils/graph.py#L246
I am just wondering if there is an intention beyond omitting to visualize just one job.
Thanks for the discussion. Closed with #350
Adding a note that mermaid syntax supports subgraph
, if it'd be useful we could show nested Flows as subgraphs? Would this be helpful?
Actually nevermind, I see this was already implemented(!) Very cool
Describe the bug I tried to run the following code.
It fails with: