-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Can't use workflow parameters inside podSpecPatch
resources request with retryStrategy
#10362
Comments
Hi @yonirab there are two issues here: first, you should use podSpecPatch: '{"containers":[{"name":"main", "resources":{"requests":{"memory": "{{=(2 ** int(retries)) * int(workflow.parameters.memreqnum)}}{{workflow.parameters.memrequnit}}" }}}]}' however, that doesn't seem to work because when the parameters are substituted the |
podSpecPatch
resources request with retryStrategy
Wow, thanks so much @eduardodbr and @agilgur5 ! |
all credit to @eduardodbr, he made reviewing it pretty easy 🙂 |
podSpecPatch
resources request with retryStrategy
podSpecPatch
resources request with retryStrategy
podSpecPatch
resources request with retryStrategy
podSpecPatch
resources request with retryStrategy
Hi @eduardodbr |
@eduardodbr @agilgur5 As mentioned by @EladProject , this only seems to work if the memory request is passed as a workflow parameter via Any chance there might be some workaround / simple fix to enable that? |
|
Sure, This works: And just to verify that inputs.parameters.memreqnum is defined correctly, |
@eduardodbr Here is a workflow that demonstrates the problem. This fails immediately with message: apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: wf-
spec:
entrypoint: wf
templates:
- name: wf
steps:
- - name: run-task1
template: run-task
arguments:
parameters:
- name: memreqnum
value: '25'
- name: memrequnit
value: Mi
- name: message
value: "hello from run-task1"
- name: run-task2
template: run-task
arguments:
parameters:
- name: memreqnum
value: '300'
- name: memrequnit
value: Mi
- name: message
value: "hello from run-task2"
- name: run-task
inputs:
parameters:
- name: memreqnum
- name: memrequnit
- name: message
retryStrategy:
limit: "2"
retryPolicy: "Always"
expression: 'lastRetry.status == "Error" or (lastRetry.status == "Failed" and asInt(lastRetry.exitCode) not in [1,2,127])'
podSpecPatch: |
containers:
- name: main
resources:
requests:
memory: "{{= (sprig.int(retries)+1)* sprig.int(inputs.parameters.memreqnum)}}{{inputs.parameters.memrequnit}}"
container:
image: docker/whalesay
command: [cowsay]
args: ["{{inputs.parameters.message}}"]
|
@eduardodbr @agilgur5 Any ideas about why the above fails? |
@eduardodbr knows this part of the codebase better than me (and wrote the PR) and I have a bit too much on my plate right now, so I'll leave it to him when he gets a chance. |
Follow-up issue regarding |
Pre-requisites
:latest
What happened/what you expected to happen?
Based on the example here, I am trying to implement exponentially increasing memory resource requests on retries.
In my case, I need to pass the
quantity
used to specify the resource request as parameters, and to be able to multiply the numeric part of the quantity on each retry.So for an initial memory resource request of
100Mi
, I set parametermemreqnum
to100
, and parametermemrequnit
toMi
.Then I thought the following should work:
Unfortunately, this returns the following error:
I have dozens of attempts to work around this, but to no avail.
It seems to me that the crux of the problem is that
workflow.parameters.memreqnum
refuses to get cast to an int value.I have tried with
asInt
,sprig.int
andsprig.atoi
- with no success.Version
v3.4.4
Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.
Logs from the workflow controller
Logs from in your workflow's wait container
The text was updated successfully, but these errors were encountered: