argo-workflowsargoproj

Define dependencies between workflows in Argo Workflows


I am trying to schedule a workflow C when both workflows A and B complete their daily run.

Is there any way to do this without using the workflow of workflows pattern?


Solution

  • I'm assuming A and B run in parallel.

    If you could incorporate workflows A and B into a single workflow AB with parallel steps A and B, then you could use a mutex to delay the execution of C until after AB finishes.

    apiVersion: argoproj.io/v1alpha1
    kind: CronWorkflow
    metadata:
      name: AB
    spec:
      schedule: "* * * * *"
      workflowSpec:
        entrypoint: AB
        synchronization:
          mutex:
            name: AB-C-mutex
        templates:
          - name: AB
            steps:
              - - name: A
                  templateRef:
                    name: A
                    template: A
                - name: B
                  templateRef:
                    name: B
                    template: B
    ---
    apiVersion: argoproj.io/v1alpha1
    kind: CronWorkflow
    metadata:
      name: C
    spec:
      schedule: "* * * * *"
      workflowSpec:
        entrypoint: C
        synchronization:
          mutex:
            name: AB-C-mutex   
     templates:
    # The rest of the workflow.
    

    You would need to make sure C starts long enough after AB for AB to claim the mutex.

    You could avoid combining A and B into one workflow if Argo supported using more than one mutex/semaphore per workflow. Currently, there are no plans to support that.

    Another option would be to combine all three workflows into a single workflow (with A and B running in parallel before C).