Skip to content

Running workflows with dependencies

Some tasks can't run until others have completed, because they depend on their results. For example, you might want to perform pulsed qubit spectroscopy before amplitude Rabi, so that you know what value to use for the qubit frequency. In this case, you'd define a dependency indicating that amplitude Rabi can only be performed after pulsed qubit spectroscopy has been completed.

When is a task considered complete?

By "complete", we mean both that the measurement and analysis must be complete. It's also possible for experiments to be executed concurrently: a new measurement can start before the analysis of a previous one is complete. If there is a dependency, however, the subsequent measurement cannot start until the previous analysis has finished successfully.

Defining dependencies

Task dependencies are defined within qruise-flow.yaml, shown below. If no dependencies are defined, tasks are executed according to the order they appear in the .yaml.

name: onboarding-04-example-1-explicit-dependencies
qubits: [Q1]
couplings: []
stages:
  init: []
  experiments:
    qubit:
      - name: ramsey
      - name: time-t1
        dependencies:
          - ramsey
      - name: readout-discriminator-train
        dependencies:
          - time-t1
    coupling: []

In this case, time-t1 cannot be executed until ramsey is complete, and readout-discriminator-train cannot be executed until time-t1 is complete. This means the tasks will be executed in the order ramseytime-t1readout-discriminator-train, regardless of their position in the .yaml. (Note, in this case, there is no change.) In other words, dependencies defined in qruise-flow.yaml always take precedence over task position. This feature allows you to easily customise task order without rearranging your entire .yaml.

Once the dependencies have been defined in qruise-flow.yaml, you can run the workflow using qruise flow run as usual.