Skip to content

Restarting process #458

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

Closed
wants to merge 6 commits into from
Closed

Restarting process #458

wants to merge 6 commits into from

Conversation

liamhuber
Copy link
Member

@liamhuber liamhuber commented Sep 18, 2024

To work with long-duration nodes on executors that survive the shutdown of the parent workflow/node python process (e.g. executorlib using slurm), we need to be able to tell the run paradigm to serialize the results, and to try to load such a serialization if we come back and the node is running.

This introduces new attributes Node.serialize_results to trigger the result serialization, and a private Node._do_clean to let power users (i.e. me writing the unit tests) stop the serialized results from getting cleaned up automatically at read-time.

Under the hood, Node now directly implements Runnable.on_run and Runnable.run_args leveraging the new detached path from #457 to make sure that each run has access to a semantically relevant path for writing the temporary output file (using cloudpickle). Child classes of Node implement new abstract methods Node._on_run and Node._run_args in place of the previous Runnable abstract methods they implemented.

TODO:

  • Figure out how to get the node/parent workflow to checkpoint itself after it has set its status to "running" when it is going to rely on serialization rebase this onto main; since breaking the Runnable.run cycle down, getting a right-before-running-checkpoint should be quite easy
  • Try it out on cmmc to make sure it actually works in production
  • Document it, probably in the deepdive

By flag, you can cloudpickle results; if already running and the results file exists it's loaded instead of running; the results file gets cleaned up either way.

This is really only _useful_ when the node is running on an executor process that _doesn't_ die when the parent process dies.
Copy link

Binder 👈 Launch a binder notebook on branch pyiron/pyiron_workflow/restarting_process

Copy link

codacy-production bot commented Sep 18, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.06% (target: -1.00%) 96.92%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c33c9e1) 3244 2961 91.28%
Head commit (4b41fdd) 3288 (+44) 3003 (+42) 91.33% (+0.06%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#458) 65 63 96.92%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@coveralls
Copy link

coveralls commented Sep 18, 2024

Pull Request Test Coverage Report for Build 10948924861

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 24 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 91.332%

Files with Coverage Reduction New Missed Lines %
draw.py 4 92.57%
node.py 20 91.46%
Totals Coverage Status
Change from base Build 10927133806: 0.06%
Covered Lines: 3003
Relevant Lines: 3288

💛 - Coveralls

@liamhuber liamhuber added the format_black trigger the Black formatting bot label Sep 19, 2024
@liamhuber
Copy link
Member Author

Superseded by #476

@liamhuber liamhuber closed this Sep 25, 2024
@liamhuber liamhuber deleted the restarting_process branch September 25, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format_black trigger the Black formatting bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants