aiidateam / aiida-workgraph

Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, and remote execution capabilities.
https://aiida-workgraph.readthedocs.io/en/latest/
MIT License
9 stars 5 forks source link

Save task state info in the ctx for checkpoint #245

Closed superstar54 closed 3 weeks ago

superstar54 commented 3 weeks ago

The engine saves the task state in the extras so that it can be accessed from outside the engine. However, this will create a mismatch when the engine process is restored from a checkpoint.

This PR saves the task state information in the context so that it can be restored from a checkpoint. The state info is also stored separately in the extras of the WorkGraph process node for each task so that we can query it. For the process node, we serialize it so that it can also be saved into the extras.

In order to interact with the running WorkGraph Engine, we need to use rpc_send to send a custom message to the engine.

codecov-commenter commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 61.11111% with 7 lines in your changes missing coverage. Please review.

Project coverage is 79.48%. Comparing base (5937b88) to head (f1e4ff6). Report is 40 commits behind head on main.

Files Patch % Lines
aiida_workgraph/engine/workgraph.py 61.53% 5 Missing :warning:
aiida_workgraph/utils/control.py 33.33% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #245 +/- ## ========================================== + Coverage 75.75% 79.48% +3.73% ========================================== Files 70 65 -5 Lines 4615 4807 +192 ========================================== + Hits 3496 3821 +325 + Misses 1119 986 -133 ``` | [Flag](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/245/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | Coverage Δ | | |---|---|---| | [python-3.11](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/245/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `79.40% <61.11%> (+3.73%)` | :arrow_up: | | [python-3.9](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/245/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `79.44% <61.11%> (+3.70%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.