Skip to content

qruise flow run

Run a flow locally.

Syntax

qruise flow run [OPTIONS]

Description

The qruise flow run command runs a QruiseOS flow locally without scheduling it or using any other infrastructure. The command exits as soon as the flow finishes and flow runs created in this way cannot be rerun from the Qruise web UI.

The qruise flow run command is especially convenient during development of a new flow, initial QPU setup, or for troubleshooting problems with a QPU. Although it can be used inside scripts or with tools such as cron, it is advised that the qruise flow schedule command is used for scheduling flows.

Options

Option

Description

-f, --flow-file

Path of the flow definition file to schedule the flow.

Default: qruise-flow.yaml.

-q, --qubits

Limit the flow run to only specified qubits. If no qubits are specified, all qubits defined in the flow file will be used. Must have the list format.

--flags

Specify flags to be used in the flow run. Must have the list format list format.

-b, --branch

The knowledge base branch to be used by the flow. Can also be set by QRUISE_FLOW_DEFAULT_INTEGRATION_BRANCH env variable.

-m, --no-merge

If specified, the flow results will not be merged to the integration branch.

-o, --output-dir

Path of the output directory for the flow relative to the flow definition file.

-s, --start

Execute only notebooks with ordinal numbers greater than or equal to the number specified.

-e, --end

Execute only notebooks with ordinal numbers less than or equal to the number specified.

-p, --profile

Specifies custom profile to be used for the run.

--help

Show a help message and exit.

Environment variables

Variable

Description

QRUISE_FLOW_DEFAULT_INTEGRATION_BRANCH

Default knowledge base to be used by the flow. See the --branch option.

QRUISE_FLOW_SKIP_MERGE

If set to True, the results will not be merged to the integration branch by default. See the --no-merge option.

Examples

Running a flow with default settings

If the current working directory is the flow directory and the flow definition file is named qruise-flow.yaml, then executing the flow with the default settings is as easy as running:

qruise flow run

If you are outside the flow directory or there are multiple flow definition files, you can manually specify which flow file to run using the --flow-file flag. For instance, if your flow file is located in $HOME/flows/my-flow.yaml, you can run it by executing:

qruise flow run --flow-file $HOME/flows/my-flow.yaml

Limiting flow run to specific qubits

Sometimes it's convenient to limit the flow run to specified qubits only. For instance, you might have observed an unexpected behaviour on qubits Q6 and Q9. To troubleshoot the problems, you could run your full calibration workflow, but that would also imply running it on qubits that are working correctly. This results in longer-than-necessary downtime, growing unnacceptably with the size and connectivity level of the QPU. Of course, you could modify the existing flow file or create a new one, but this approach is cumbersome, error prone, and does not scale.

In such cases, you can use the --qubits flag to limit the qubits the flow will be run on without modifying the flow definition file. For instance, running the following:

qruise flow run --qubits Q6,Q9

will execute the flow defined in qruise-flow.yaml file, but only for qubits Q6 and Q9. Similarly, couplings involving qubits other than those two will be ignored by the flow.

Custom experiment selection

Operating a QPU often requires running a custom selection of experiments defined in the flow file, e.g. during debugging or the initial bootstrap procedure. Qruise CLI supports two different methods for achieving this goal:

  • limiting the range of notebooks based on the notebook ordinal number
  • flag-based selection

Both are described in detail in the following subsections.

Limiting the range of notebooks based on the notebook ordinal number

Suppose you want to include only experiments defined in notebooks numbered 13 to 83. To do so, you can use the --start and --end flags:

qruise flow run --start 13 --end 83

Range specification

The range specified by --start and --end is inclusive on both ends. Thus, passing --start 13 and --end 83 will result in both notebooks 13 and 83 being executed (as well as everything in between).

You can also encouter a situation in which you want to start a flow from a certain experiment, e.g. if the previous flow run got aborted due to an error in your code, say in the experiment defined in notebook 13. In this case, you just need to specify the --start option:

qruise flow run --start 13

Running the above will result in a flow that includes all experiments numbered 13 and above.

Conversely, you might want to terminate the flow at some earlier point. To do so, use the --end option alone:

qruise flow run --end 83

This will result in the flow executing all experiments with ordinals less than or equal to 83.

Flag-based selection

The --start and --end parameters can only be used to specify a continuous range. As a result, it's impossible to exclude any experiment within this range using this approach alone. This can be cumbersome if you want to partition your experiments in some other way, e.g. initial bootstrap, single-qubit, two-qubit, and so on. To achieve this partitioning, you can define inclusion and exclusion flags.

You can pass flags to the flow using the --flags option, e.g.:

qruise flow run --flags flag_name

You can also pass multiple flags using a comma-separated list:

qruise flow run --flags flag1,flag2,flag3

Customising interaction with the knowledge base

During the development phase of the flow or while experimenting with the QPU, it's convenient to use data from a custom branch in the knowledge base. This can be achieved by specifying the --branch option.

For instance, you might want to create a new branch in the knowledge base named experimental. If you want to use it as the source of data for your flow, simply run

qruise flow run --branch experimental

In some cases, you might want to omit committing any experiment results or calibration data after the flow is finished. In this case, you can also specify the --no-merge flag:

qruise flow run  --branch experimental --no-merge