8000 fix: support repeat policy for nested DAGs by yottahmd · Pull Request #1022 · dagu-org/dagu · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: support repeat policy for nested DAGs #1022

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

Merged
merged 9 commits into from
Jun 17, 2025
Merged

fix: support repeat policy for nested DAGs #1022

merged 9 commits into from
Jun 17, 2025

Conversation

yottahmd
Copy link
Collaborator
@yottahmd yottahmd commented Jun 17, 2025

Summary

This PR fixes issue #1013 where RepeatPolicy did not work properly with nested DAGs (sub-workflows). The bug caused repeated runs to fail after the first execution, with sub-workflows remaining in "not started" status and creating zombie processes.

Changes

  • Fix child DAG run ID generation for repeated executions: Added a repeated flag to GenerateChildDAGRunID() that includes randomness when generating IDs for repeated nested DAG runs, preventing ID collisions
  • Track repeated state in node execution: Added Repeated field to NodeState to identify when a step is being repeated
  • Add repeat limit functionality: Implemented a limit field in RepeatPolicy to cap the maximum number of executions
  • Fix JSON output formatting: Added newlines to JSON outputs in dag.go and parallel.go executors for proper formatting
  • Add comprehensive tests: Added integration tests for repeat policy with limits and nested DAGs
  • Update documentation: Added repeat limit documentation and examples

Why

The root cause was that repeated nested DAG runs were generating the same run ID on subsequent executions, causing conflicts in the execution tracking system. By adding randomness to the run ID generation for repeated steps, each execution gets a unique identifier, allowing proper tracking and preventing zombie processes.

The addition of the repeat limit feature provides users with better control over long-running repeat policies, preventing infinite loops and resource exhaustion.

Reported-by: jeremydelattre59
Github-Issue: #1013

Copy link
cloudflare-workers-and-pages bot commented Jun 17, 2025

Deploying dagu-doc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3b93a0a
Status: ✅  Deploy successful!
Preview URL: https://f2ec08fe.dagu-doc.pages.dev
Branch Preview URL: https://fix-repeat-policy.dagu-doc.pages.dev

View logs

@yottahmd yottahmd merged commit d9eaa13 into main Jun 17, 2025
6 checks passed
@yottahmd yottahmd deleted the fix-repeat-policy branch June 17, 2025 15:59
Copy link
codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 63.26531% with 36 lines in your changes missing coverage. Please review.

Project coverage is 67.68%. Comparing base (fa43a69) to head (3b93a0a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/models/node.go 40.00% 21 Missing ⚠️
internal/digraph/scheduler/node.go 61.11% 5 Missing and 2 partials ⚠️
internal/digraph/scheduler/data.go 66.66% 5 Missing ⚠️
internal/digraph/scheduler/eval.go 72.72% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1022      +/-   ##
==========================================
+ Coverage   65.83%   67.68%   +1.84%     
==========================================
  Files          93       93              
  Lines       13785    13840      +55     
==========================================
+ Hits         9076     9368     +292     
+ Misses       3926     3672     -254     
- Partials      783      800      +17     
Files with missing lines Coverage Δ
internal/digraph/builder.go 67.49% <100.00%> (+0.03%) ⬆️
internal/digraph/loader.go 66.20% <100.00%> (+0.23%) ⬆️
internal/digraph/scheduler/scheduler.go 88.39% <100.00%> (+0.11%) ⬆️
internal/digraph/step.go 91.66% <ø> (ø)
internal/digraph/scheduler/eval.go 82.75% <72.72%> (+15.22%) ⬆️
internal/digraph/scheduler/data.go 82.79% <66.66%> (-0.92%) ⬇️
internal/digraph/scheduler/node.go 67.77% <61.11%> (+11.48%) ⬆️
internal/models/node.go 46.37% <40.00%> (+23.56%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa43a69...3b93a0a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0