-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce DirectoryObject and FileObject in Workflow #725
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. One UX question.
Needs tests though. files.py
is super readable and I don't see anything that could go wrong, but tests should be there at least for the coverage 😉 For the workflow and nodes I actually see tests being useful as they lock-in two promises:
- Paths are based off labels (this is actually mis-spoken in the PR comment, it uses the node label not the function name -- these are the same by default but can change, and even do change in your example!)
- Nodes not being able to create a file if not in a workflow (maybe we want to change that spec later, but for now I like it)
At first I thought it might be overkill to put create_file
right on Node
(as it wouldn't be accessible to any node that doesn't define self
in the function argument), but actually (a) I don't mind the extra code that much, and (b) maybe we can exploit it when it comes time to serialize IO. So I want to keep in the back of our minds the idea of refactoring these methods away to some more specific child class, but for now it seems perfectly appropriate to have it here.
Ah yes, I left a comment in the botched previous PR saying I was waiting for the first comments but I forgot to write the same in this PR.
Yeah it's good that we talk about it, because until I saw this PR I didn't really think that the label can be different.
I also thought about defining it in |
Thanks, @samwaseda! I like the clear separation into two classes and the functionality very much. In addition to the present functionality, I would like to have the option for a single node to create multiple working directories. The idea is that a single node can createeach several tasks, each needing a separate working directory. A simple example is a Murnaghan node, where several atomistic jobs (with each a separate working directory) need to be created. Thus, nodes should be able to create subdirectories with the working directory of the workflow being the parent directory. |
There, I think there's a bit of a difference in terminology with respect to the current implementation of This being said, there indeed should be a functionality that allows a workflow folder within a parent workflow. I just didn't do it because I didn't see a possibility in the current implementation how to see whether a workflow is attached to a parent workflow (i.e. I don't know if it's possible for a child workflow to know whether it has a parent workflow). Comments from @liamhuber might be appreciated here. |
No, Joerg is correct; you can in principle have a node that executes the entire Murnaghan procedure. It doesn't even need to make sub-nodes out of the steps! The idea that nodes are functional and idempotent is a "best practice" and not strictly enforced, and even here you could have a node that starts a pyiron project, makes a bunch of lammps jobs, runs everything, scrapes the results, and finishes that is both idempotent and functional! Of course, you also could make a A |
I could have sworn GitHub used to rebase stacked PRs onto main automatically when their target got merged and deleted.... |
Pull Request Test Coverage Report for Build 5387100971
💛 - Coveralls |
Test failures on `` look like they're just typical windows stuff, although the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to extend the tests as here, but otherwise once the tests are passing this is looking alright to me.
I was unnecessarily calling all functions starting with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super.
I think there is a way to more elegantly convert "test/tests"
to look like a path from the current system than to convert all the references to "/", but what you do here is clear and effective so it's also ok with me.
This PR allows for working files which some softwares require.
FileObject
handles only the file and has no information of address i.e. it must be attached to aDirectoryObject
Workflow
-> aNode
cannot create a directory if it is not attached to aWorkflow
workflow.working_directory
is called.workflow_name/function_name/file_name
Example I:
Output:
Example II
Closes #702