[ANSIBLE] Automated PR for dagu-dag-examples_2025-09-07T20-00-10 - #7 #7
@@ -0,0 +1,2 @@
|
||||
# This file indicates that example DAGs have been created.
|
||||
# Delete this file to re-create examples on next startup.
|
||||
@@ -0,0 +1,11 @@
|
||||
# Basic Sequential Execution
|
||||
# Steps execute one after another in order
|
||||
|
||||
description: Execute steps one after another
|
||||
|
||||
steps:
|
||||
- command: echo "Step 1 - Starting workflow"
|
||||
|
||||
- command: echo "Step 2 - Processing data"
|
||||
|
||||
- command: echo "Step 3 - Workflow complete"
|
||||
@@ -0,0 +1,41 @@
|
||||
# Parallel Execution
|
||||
# Run multiple tasks simultaneously
|
||||
|
||||
description: Execute multiple tasks in parallel
|
||||
|
||||
steps:
|
||||
- name: setup
|
||||
command: echo "Setting up environment"
|
||||
|
||||
# These steps run in parallel after setup
|
||||
- name: task-a
|
||||
command: |
|
||||
echo "Task A starting"
|
||||
sleep 2
|
||||
echo "Task A complete"
|
||||
depends:
|
||||
- setup
|
||||
|
||||
- name: task-b
|
||||
command: |
|
||||
echo "Task B starting"
|
||||
sleep 2
|
||||
echo "Task B complete"
|
||||
depends:
|
||||
- setup
|
||||
|
||||
- name: task-c
|
||||
command: |
|
||||
echo "Task C starting"
|
||||
sleep 2
|
||||
echo "Task C complete"
|
||||
depends:
|
||||
- setup
|
||||
|
||||
# Wait for all parallel tasks to complete
|
||||
- name: merge-results
|
||||
command: echo "All parallel tasks completed"
|
||||
depends:
|
||||
- task-a
|
||||
- task-b
|
||||
- task-c
|
||||
@@ -0,0 +1,21 @@
|
||||
# Scheduled Workflows
|
||||
# Run workflows automatically on a schedule
|
||||
|
||||
description: Example of a scheduled workflow
|
||||
# Uncomment to run daily at 2:00 AM
|
||||
# schedule: "0 2 * * *"
|
||||
|
||||
# Schedule examples:
|
||||
# "0 * * * *" - Every hour
|
||||
# "*/5 * * * *" - Every 5 minutes
|
||||
# "0 9 * * 1-5" - Weekdays at 9 AM
|
||||
# "0 0 1 * *" - First day of each month
|
||||
|
||||
histRetentionDays: 7 # Keep 7 days of history
|
||||
|
||||
steps:
|
||||
- command: |
|
||||
echo "Running scheduled task"
|
||||
echo "Current time: $(date)"
|
||||
|
||||
- command: echo "Cleaning up old data"
|
||||
@@ -0,0 +1,24 @@
|
||||
# Nested Workflows
|
||||
# Call other workflows as sub-workflows
|
||||
|
||||
description: Example of nested workflows
|
||||
|
||||
steps:
|
||||
- command: echo "Preparing data for sub-workflows"
|
||||
|
||||
- run: sub-workflow
|
||||
params: "TASK_ID=123"
|
||||
|
||||
- command: echo "Main workflow completed"
|
||||
|
||||
---
|
||||
# Sub-workflow definition
|
||||
name: sub-workflow
|
||||
description: Sub-workflow that gets called by main
|
||||
params:
|
||||
- TASK_ID: "000"
|
||||
|
||||
steps:
|
||||
- command: echo "Sub-workflow executing with TASK_ID=${TASK_ID}"
|
||||
|
||||
- command: echo "Sub-workflow step 2"
|
||||
@@ -0,0 +1,18 @@
|
||||
# Container-based Workflow
|
||||
# Using a container for all steps
|
||||
|
||||
description: Run workflow steps in a Python container
|
||||
|
||||
container:
|
||||
image: python:3.13
|
||||
volumes:
|
||||
- /tmp/data:/data
|
||||
|
||||
steps:
|
||||
- # write data to a file
|
||||
command: |
|
||||
python -c "with open('/data/output.txt', 'w') as f: f.write('Hello from Dagu!')"
|
||||
|
||||
- # read data from the file
|
||||
command: |
|
||||
python -c "with open('/data/output.txt') as f: print(f.read())"
|
||||
Reference in New Issue
Block a user