Skip to content

Commit

Permalink
add example for each trigger type
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel committed Jun 29, 2024
1 parent ffeebfb commit 34d4a54
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/examples/dag.yaml → docs/examples/after.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ flows:
targets:
sleep-and-echo:
commands: |
sleep 2
sleep 1
echo "Hi from {{ id }}!"
15 changes: 15 additions & 0 deletions docs/examples/once.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
flows:
default:
nodes:
1:
target: sleep-and-echo
2:
target: sleep-and-echo
3:
target: sleep-and-echo

targets:
sleep-and-echo:
commands: |
sleep 1
echo "Hi from {{ id }}!"
19 changes: 19 additions & 0 deletions docs/examples/restart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
flows:
default:
nodes:
1:
target: sleep-and-echo
trigger:
type: restart
delay: 3
2:
target: sleep-and-echo
trigger:
type: restart
delay: 1

targets:
sleep-and-echo:
commands: |
sleep 1
echo "Hi from {{ id }}!"
19 changes: 19 additions & 0 deletions docs/examples/watch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
flows:
default:
nodes:
1:
target: sleep-and-echo
trigger:
type: watch
paths: ["synthesize/", "tests/"]
2:
target: sleep-and-echo
trigger:
type: watch
paths: [ "docs/" ]

targets:
sleep-and-echo:
commands: |
sleep 1
echo "Hi from {{ id }}!"
28 changes: 26 additions & 2 deletions docs/triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,37 @@

## Trigger Types

### Once

```yaml
--8<-- "docs/examples/once.yaml"
```

@mermaid(docs/examples/once.yaml)

### After

```yaml
--8<-- "docs/examples/dag.yaml"
--8<-- "docs/examples/after.yaml"
```

@mermaid(docs/examples/after.yaml)

### Restart

```yaml
--8<-- "docs/examples/restart.yaml"
```

@mermaid(docs/examples/restart.yaml)

### Watch

```yaml
--8<-- "docs/examples/watch.yaml"
```

@mermaid(docs/examples/dag.yaml)
@mermaid(docs/examples/watch.yaml)

## Combining Triggers

Expand Down

0 comments on commit 34d4a54

Please sign in to comment.