mbruns91 / graphathon

0 stars 0 forks source link

Implement DOT based workflow skeleton creator #6

Open samwaseda opened 3 weeks ago

samwaseda commented 3 weeks ago

Based on this discussion (thanks @liamhuber) I implemented the functionality to create empty functions for pyiron workflow. I didn't really add comments in the notebook, but I guess it's relatively straightforward if you look at dot.ipynb and read the issue page.

In order to address the concern raised by @liamhuber, I also added the possibility to include types in labels with the same notation as in function, such as vehicle: str.

samwaseda commented 3 weeks ago

@liamhuber I just failed to talk to you but maybe you have a good idea: There's one part I don't particularly like about this workflow right now, which is the fact that the user is required to copy and paste the content of EmptyGraph.get_str() in the notebook to make a pyiron workflow. Do you have maybe an idea?

liamhuber commented 3 weeks ago

@samwaseda, I guess instead of EmptyGraph.get_str it should be possible to define EmptyGraph.to_workflow(wf_label: str) -> Workflow that returns the instance right away, i.e. you would be able to write

...
wf = eg.to_workflow("travel_time")
wf.draw()
wf(
    vehicle__vehicle="Car",
    ...
)  # but I guess this would crash unless we're super clever about spoofing the nodes...

However, I'm not sure that's actually what we want; maybe we really want them to have that string to modify. By the same token you could exec the string, but it's also missing the input definitions and again maybe the string itself is what's wanted.

samwaseda commented 2 weeks ago

Yep now as you pointed out it appears so obvious that we need a function to return a workflow. Let me see what I can do