-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable template name conflict detection (#1153)
**Pull Request Checklist** - [X] Fixes #1151 - [X] Tests added - [X] Documentation/examples added - [x] [Good commit messages](https://cbea.ms/git-commit/) and/or PR title **Description of PR** Currently, template name conflict detection is causing a stack overflow when run on a recursive template. This PR removes template name conflict detection, which was added in #1054. --------- Signed-off-by: Alice Purcell <[email protected]>
- Loading branch information
1 parent
ce91207
commit 8a764a9
Showing
5 changed files
with
80 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: WorkflowTemplate | ||
metadata: | ||
name: my-workflow | ||
spec: | ||
entrypoint: steps | ||
templates: | ||
- name: sub-steps | ||
steps: | ||
- - name: random-roll | ||
template: random-roll | ||
- - arguments: | ||
parameters: | ||
- name: input-num | ||
value: '{{steps.random-roll.outputs.result}}' | ||
name: recurse | ||
template: sub-steps | ||
when: '{{steps.random-roll.outputs.result}} != 0' | ||
- name: random-roll | ||
script: | ||
command: | ||
- python | ||
image: python:3.8 | ||
source: |- | ||
import os | ||
import sys | ||
sys.path.append(os.getcwd()) | ||
import random | ||
return random.randint(0, 2) | ||
- name: steps | ||
steps: | ||
- - name: sub-steps | ||
template: sub-steps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from hera.workflows import Step, Steps, WorkflowTemplate, script | ||
|
||
|
||
@script(constructor="inline") | ||
def random_roll(): | ||
import random | ||
|
||
return random.randint(0, 2) | ||
|
||
|
||
with WorkflowTemplate(name="my-workflow", entrypoint="steps") as w: | ||
with Steps(name="sub-steps") as sub_steps: | ||
random_number = random_roll() | ||
Step( | ||
name="recurse", | ||
arguments={"input-num": random_number.result}, | ||
template=sub_steps, | ||
when=f"{random_number.result} != 0", | ||
) | ||
|
||
with Steps(name="steps"): | ||
sub_steps() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters