diff --git a/README.md b/README.md index da534e198..51f7dbb9f 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ targets: [0] ``` ### How to run protocols -To run the protocols specified in the ```runcard```, Qibocal uses the `qq auto` command +To run the protocols specified in the ```runcard```, Qibocal uses the `qq run` command ```sh -qq auto -o +qq run -o ``` if `````` is specified, the results will be saved in it, otherwise ```qq``` will automatically create a default folder containing the current date and the username. diff --git a/doc/source/getting-started/example.rst b/doc/source/getting-started/example.rst index d4ae31b0b..2917c649a 100644 --- a/doc/source/getting-started/example.rst +++ b/doc/source/getting-started/example.rst @@ -29,4 +29,4 @@ Run the routine .. code-block:: - qq auto example.yml -o resonator_spectroscopy_routine + qq run example.yml -o resonator_spectroscopy_routine diff --git a/doc/source/getting-started/interface.rst b/doc/source/getting-started/interface.rst index 74ee9eb29..2350dcc84 100644 --- a/doc/source/getting-started/interface.rst +++ b/doc/source/getting-started/interface.rst @@ -60,15 +60,15 @@ regarding the protocols executed. qq report -``qq auto`` +``qq run`` ^^^^^^^^^^^ -The previous commands are put together using ``qq auto`` which will perform data acquisition, post-processing and report generation. +The previous commands are put together using ``qq run`` which will perform data acquisition, post-processing and report generation. When executing multiple protocols they are executed following the actions specified in the runcard. .. code-block:: - qq auto -o + qq run -o ``qq update`` ^^^^^^^^^^^^^ diff --git a/doc/source/protocols/dispersive_shift.rst b/doc/source/protocols/dispersive_shift.rst index d4a19e67c..70f4c731a 100644 --- a/doc/source/protocols/dispersive_shift.rst +++ b/doc/source/protocols/dispersive_shift.rst @@ -55,7 +55,7 @@ It follows an example of the experiment parameters. freq_width: 1000000 -After running `qq auto`, the experiment is executed and the result will looks like +After running `qq run`, the experiment is executed and the result will looks like the following picture. .. image:: dispersive_shift.png diff --git a/doc/source/protocols/rabi/rabi.rst b/doc/source/protocols/rabi/rabi.rst index 360d03093..5a3de5c1e 100644 --- a/doc/source/protocols/rabi/rabi.rst +++ b/doc/source/protocols/rabi/rabi.rst @@ -60,7 +60,7 @@ It follows an example of the experiment parameters. To run properly this experiment it is important to set the `relaxation_time` higher than the qubit `T1`. -After running `qq auto`, the experiment is executed and the result will looks like +After running `qq run`, the experiment is executed and the result will looks like the following picture. .. image:: rabi_amplitude.png diff --git a/src/qibocal/cli/_base.py b/src/qibocal/cli/_base.py index 57fdb9da1..cf4aa2838 100644 --- a/src/qibocal/cli/_base.py +++ b/src/qibocal/cli/_base.py @@ -8,10 +8,10 @@ from ..auto.runcard import Runcard from .acquisition import acquire as acquisition -from .autocalibration import autocalibrate from .compare import compare_reports from .fit import fit as fitting from .report import report as reporting +from .run import protocols_execution from .update import update as updating from .upload import upload_report @@ -58,8 +58,8 @@ def command(): default=None, help="Name of the Qibo backend.,", ) -def auto(runcard, folder, force, update, platform, backend): - """Autocalibration. +def run(runcard, folder, force, update, platform, backend): + """Execute the qubit calibration. Arguments: @@ -72,7 +72,7 @@ def auto(runcard, folder, force, update, platform, backend): if backend is not None: runcard.backend = backend - autocalibrate(runcard, folder, force, update) + protocols_execution(runcard, folder, force, update) @command.command(context_settings=CONTEXT_SETTINGS) @@ -236,3 +236,48 @@ def upload(path, tag, author): ) def compare(report_1_path, report_2_path, folder, force): compare_reports(folder, report_1_path, report_2_path, force) + + +@command.command(context_settings=CONTEXT_SETTINGS, deprecated=True) +@click.argument( + "runcard", metavar="RUNCARD", type=click.Path(exists=True, path_type=pathlib.Path) +) +@click.option( + "folder", + "-o", + type=click.Path(path_type=pathlib.Path), + help="Output folder. If not provided a standard name will generated.", +) +@click.option( + "force", + "-f", + is_flag=True, + help="Use --force option to overwrite the output folder.", +) +@click.option( + "--update/--no-update", + default=True, + help="Use --no-update option to avoid updating iteratively the platform." + "With this option the new runcard will not be produced.", +) +@click.option( + "--platform", + default=None, + help="Name of the Qibolab platform.", +) +@click.option( + "--backend", + default=None, + help="Name of the Qibo backend.,", +) +def auto(runcard, folder, force, update, platform, backend): + """Execute the qubit calibration. + + Arguments: + + - RUNCARD: runcard with declarative inputs. + """ + click.echo( + "Warning: This command is deprecated and may be removed in a future version. Please use 'qq run' instead. ", + err=True, + ) diff --git a/src/qibocal/cli/autocalibration.py b/src/qibocal/cli/run.py similarity index 94% rename from src/qibocal/cli/autocalibration.py rename to src/qibocal/cli/run.py index 6e4686369..5edc9e46f 100644 --- a/src/qibocal/cli/autocalibration.py +++ b/src/qibocal/cli/run.py @@ -9,7 +9,7 @@ from .report import report -def autocalibrate(runcard: Runcard, folder: Path, force, update): +def protocols_execution(runcard: Runcard, folder: Path, force, update): """Autocalibration. Arguments: diff --git a/tests/test_cli.py b/tests/test_cli.py index 398aca13c..8e46b424f 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -19,7 +19,7 @@ def test_qq_update(update, tmp_path, monkeypatch): runner = CliRunner() runner.invoke( command, - ["auto", str(DUMMY_ACTION), "-o", str(output_folder), "-f", update], + ["run", str(DUMMY_ACTION), "-o", str(output_folder), "-f", update], catch_exceptions=False, ) @@ -85,8 +85,8 @@ def test_compare_report_dates(tmp_path): compare_dir = tmp_path / "compare_dir" runner = CliRunner() - runner.invoke(command, ["auto", str(DUMMY_COMPARE), "-o", str(report_dir_1), "-f"]) - runner.invoke(command, ["auto", str(DUMMY_COMPARE), "-o", str(report_dir_2), "-f"]) + runner.invoke(command, ["run", str(DUMMY_COMPARE), "-o", str(report_dir_1), "-f"]) + runner.invoke(command, ["run", str(DUMMY_COMPARE), "-o", str(report_dir_2), "-f"]) runner.invoke( command, diff --git a/tests/test_output.py b/tests/test_output.py index 32449cab4..718339d33 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -25,7 +25,7 @@ ACTION = Action(**action) -# TODO: this is essentially a proto `qq auto` invocation, it should be simplified as +# TODO: this is essentially a proto `qq run` invocation, it should be simplified as # much as possible in the library, and made available in conftest @pytest.fixture def fake_output(tmp_path: Path) -> tuple[Output, Path]: diff --git a/tests/test_protocols.py b/tests/test_protocols.py index b5278a5a0..fdf9748f0 100644 --- a/tests/test_protocols.py +++ b/tests/test_protocols.py @@ -62,19 +62,19 @@ def locate_tomography_file(runcard): @pytest.mark.parametrize("update", ["--update", "--no-update"]) @pytest.mark.parametrize("runcard", generate_runcard_single_protocol(), ids=idfn) -def test_auto_command(runcard, update, tmp_path): +def test_run_command(runcard, update, tmp_path): """Test auto command pipeline.""" runcard = runcard[0] locate_tomography_file(runcard) (tmp_path / SINGLE_ACTION_RUNCARD).write_text(yaml.safe_dump(runcard)) - outpath = tmp_path / "auto_test" + outpath = tmp_path / "run_test" runner = CliRunner() runner.invoke( command, [ - "auto", + "run", str(tmp_path / SINGLE_ACTION_RUNCARD), "-o", str(outpath),