Argo: how to repeat until a specific (half-hour) time, every x minutes with a Forbid concurrencyPolicy?

46 views Asked by At

I am using Argo to try the following behaviour:

I would like to execute a certain script every 5 minutes from, for example, 12:30 to 18:30. I does not matter what the exitCode of the script is, it should execute every 5 minutes (Except in case there is a current execution running)

So I created a proof-of-concept with a yml like the following:

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
  generateName: proofconcept
spec:
  schedule: "30 12 * * *"
  timezone: "Europe/Madrid"
  startingDeadlineSeconds: 0
  concurrencyPolicy: "Forbid"
  successfulJobsHistoryLimit: 10
  failedJobsHistoryLimit: 10
  suspend: false
  workflowSpec:
    entrypoint: retry-container
    templates:
      - name: retry-container
        retryStrategy:
          expression: "asInt(lastRetry.exitCode) > -1"
          backoff:
            duration: "5m"
        container:
          image: python:alpine3.6
          command: ["python", -c]
          args: ["import random; import sys; exit_code = random.choice(range(0, 2)); sys.exit(exit_code)"]

The result is not as I expected. The execution does not repeat when exitCode == 0.

And even if so, I would have to control the stop time. What I don't see any example about how to do it.

I guess another option is to split my CronWorkflow in 3, using different schedule options: "30/5 12 * * *", "0/5 12-17 * * *", "0,5,10,15,20,25,30 18 * * *". But how can I control concurrency policy in this case? (This is a dummy example, but in a real case my script execution time could vary a lot, from a few seconds to several minutes)

Is there any way to get this expected behaviour with Argo?

0

There are 0 answers