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-02-running-a-workflow
qubits: [Q1]
couplings: []
stages:
  init: []
  experiments:
    qubit:
      - name: resonator-spectroscopy
      - name: filter-spectroscopy
        dependencies:
          - resonator-spectroscopy
      - name: pulsed-spectroscopy
        dependencies:
          - filter-spectroscopy
    coupling: []

In this case, pulsed-spectroscopy cannot be executed until filter-spectroscopy is complete, and filter-spectroscopy cannot be executed until resonator-spectroscopy is complete. This means the tasks will be executed in the order resonator-spectroscopyfilter-spectroscopypulsed-spectroscopy, 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 qruise-flow.yaml, you can run the workflow using qruise flow run as usual.