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

support nested while task #219

Closed superstar54 closed 1 month ago

superstar54 commented 1 month ago

Generalized Logic for Handling Zones and Tasks

  1. Treat Every Task as a Zone:

    • Every task should be treated as a "zone," whether it's a normal task or a while zone.
    • This approach ensures consistency in how tasks and zones are handled, simplifying the logic.
  2. Identify Zone Inputs:

    • For each zone (or task), identify its input tasks. These are tasks that are outside the zone but have a link into the zone.
    • Specifically, look for tasks that are inputs to the zone and identify their parent tasks. The parent task should be the one that shares the same parent as the zone. Use this parent task as the final input task.
  3. Determine Task Readiness:

    • Use the identified zone inputs and the task's parent to determine if a task is ready to execute.
    • A task is considered ready to run if all its input tasks have been completed and the task's parent is in a state that allows execution.

I tested it using the following nested while zone.

Screenshot from 2024-08-13 07-33-43

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 98.06452% with 3 lines in your changes missing coverage. Please review.

Project coverage is 76.40%. Comparing base (5937b88) to head (4897f18). Report is 20 commits behind head on main.

Files Patch % Lines
aiida_workgraph/utils/analysis.py 96.82% 2 Missing :warning:
aiida_workgraph/utils/__init__.py 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #219 +/- ## ========================================== + Coverage 75.75% 76.40% +0.65% ========================================== Files 70 70 Lines 4615 4976 +361 ========================================== + Hits 3496 3802 +306 - Misses 1119 1174 +55 ``` | [Flag](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/219/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/219/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `76.28% <98.06%> (+0.61%)` | :arrow_up: | | [python-3.12](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/219/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `76.30% <98.06%> (?)` | | | [python-3.9](https://app.codecov.io/gh/aiidateam/aiida-workgraph/pull/219/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aiidateam) | `76.35% <98.06%> (+0.61%)` | :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.