How to mute status messages during calculations
Change the verbosity of the messaging
When running calculations on Boulder Opal, you receive information of their status via printed messages. These display for instance, whether a task has started or completed, and include a unique action ID you can use to identify and manage the calculation.
In this user guide we demonstrate how to change this behavior and mute these messages.
Selecting the message verbosity
Choosing the display behavior during authentication
By default, messsages updating you on the status of your calculations will be displayed during calculations.
You can use boulderopal.cloud.set_verbosity
to choose how you want to be notified of the progress of your tasks.
For instance, you can mute them with boulderopal.cloud.set_verbosity("QUIET")
.
def run_calculation():
"""
Run a simple π-pulse simulation and print the resulting infidelity.
"""
graph = bo.Graph()
amplitude = np.pi * 1e5 # rad/s
duration = 5e-6 # s
pi_pulse = graph.constant_pwc(amplitude, duration)
infidelity = graph.infidelity_pwc(
hamiltonian=pi_pulse * graph.pauli_matrix("X"),
target=graph.target(graph.pauli_matrix("X")),
name="infidelity",
)
result = bo.execute_graph(graph, "infidelity")
print(f"Infidelity: {result['output']['infidelity']['value']:.3e}")
return result
import numpy as np
import boulderopal as bo
# Mute messges from Boulder Opal calls.
bo.cloud.set_verbosity("QUIET")
# Run simple calculation.
result = run_calculation()
Infidelity: 4.441e-16
You can also turn the messages back on with "VERBOSE".
# Turning on output messages.
bo.cloud.set_verbosity("VERBOSE")
result = run_calculation()
Your task (action_id="1828558") has completed.
Infidelity: 4.441e-16
Retrieving action IDs
Note that by muting the messages for calculations, their corresponding action IDs will not be displayed. These are useful in case you want to retrieve the calculation results at a later time, see this user guide for more details. In that case, you can still retrieve the action ID in the Boulder Opal web app.