From 21768547dd7d8f24b2c17ecf22273204d64fb5bc Mon Sep 17 00:00:00 2001 From: Olivia Lynn Date: Fri, 22 Dec 2023 16:53:47 -0500 Subject: [PATCH] Add short description of running pipelines w ceci shell cmd --- .../Build_Save_Load_Run_Pipeline.ipynb | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/examples/core_examples/Build_Save_Load_Run_Pipeline.ipynb b/examples/core_examples/Build_Save_Load_Run_Pipeline.ipynb index e174c16..460394a 100644 --- a/examples/core_examples/Build_Save_Load_Run_Pipeline.ipynb +++ b/examples/core_examples/Build_Save_Load_Run_Pipeline.ipynb @@ -8,7 +8,7 @@ "\n", "**Author:** Eric Charles\n", "\n", - "**Last Run Successfully:** August 2, 2023" + "**Last Run Successfully:** December 22, 2023" ] }, { @@ -43,7 +43,7 @@ "from rail.creation.engines.flowEngine import FlowCreator, FlowPosterior\n", "from rail.core.data import TableHandle\n", "from rail.core.stage import RailStage\n", - "from rail.core.util_stages import ColumnMapper, TableConverter\n" + "from rail.core.util_stages import ColumnMapper, TableConverter" ] }, { @@ -64,7 +64,7 @@ "outputs": [], "source": [ "DS = RailStage.data_store\n", - "DS.__class__.allow_overwrite = True\n" + "DS.__class__.allow_overwrite = True" ] }, { @@ -100,7 +100,7 @@ "bands = [\"u\", \"g\", \"r\", \"i\", \"z\", \"y\"]\n", "band_dict = {band: f\"mag_{band}_lsst\" for band in bands}\n", "rename_dict = {f\"mag_{band}_lsst_err\": f\"mag_err_{band}_lsst\" for band in bands}\n", - "post_grid = [float(x) for x in np.linspace(0.0, 5, 21)]\n" + "post_grid = [float(x) for x in np.linspace(0.0, 5, 21)]" ] }, { @@ -147,7 +147,7 @@ "\n", "table_conv_test = TableConverter.make_stage(\n", " name=\"table_conv_test\", output_format=\"numpyDict\", seed=12345\n", - ")\n" + ")" ] }, { @@ -156,7 +156,7 @@ "metadata": {}, "outputs": [], "source": [ - "flow_engine_test.sample(6, seed=0).data\n" + "flow_engine_test.sample(6, seed=0).data" ] }, { @@ -177,7 +177,7 @@ "pipe = ceci.Pipeline.interactive()\n", "stages = [flow_engine_test, lsst_error_model_test, col_remapper_test, table_conv_test]\n", "for stage in stages:\n", - " pipe.add_stage(stage)\n" + " pipe.add_stage(stage)" ] }, { @@ -198,7 +198,7 @@ "outputs": [], "source": [ "# Get the names of the stages\n", - "pipe.stage_names\n" + "pipe.stage_names" ] }, { @@ -208,7 +208,7 @@ "outputs": [], "source": [ "# Get the configuration of a particular stage\n", - "pipe.flow_engine_test.config\n" + "pipe.flow_engine_test.config" ] }, { @@ -219,7 +219,7 @@ "source": [ "# Get the list of outputs 'tags'\n", "# These are how the stage thinks of the outputs, as a list names associated to DataHandle types.\n", - "pipe.flow_engine_test.outputs\n" + "pipe.flow_engine_test.outputs" ] }, { @@ -230,7 +230,7 @@ "source": [ "# Get the list of outputs 'aliased tags'\n", "# These are how the pipeline things of the outputs, as a unique key that points to a particular file\n", - "pipe.flow_engine_test._outputs\n" + "pipe.flow_engine_test._outputs" ] }, { @@ -252,7 +252,7 @@ "lsst_error_model_test.connect_input(flow_engine_test)\n", "col_remapper_test.connect_input(lsst_error_model_test)\n", "# flow_post_test.connect_input(col_remapper_test, inputTag='input')\n", - "table_conv_test.connect_input(col_remapper_test)\n" + "table_conv_test.connect_input(col_remapper_test)" ] }, { @@ -278,7 +278,7 @@ "source": [ "pipe.initialize(\n", " dict(model=flow_file), dict(output_dir=\".\", log_dir=\".\", resume=False), None\n", - ")\n" + ")" ] }, { @@ -300,7 +300,7 @@ "metadata": {}, "outputs": [], "source": [ - "pipe.save(\"pipe_saved.yml\")\n" + "pipe.save(\"pipe_saved.yml\")" ] }, { @@ -316,7 +316,7 @@ "metadata": {}, "outputs": [], "source": [ - "pr = ceci.Pipeline.read(\"pipe_saved.yml\")\n" + "pr = ceci.Pipeline.read(\"pipe_saved.yml\")" ] }, { @@ -334,7 +334,15 @@ "metadata": {}, "outputs": [], "source": [ - "pr.run()\n" + "pr.run()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Running saved pipelines from the command line\n", + "Once you've saved a pipeline and have the `pipeline_name.yml` and `pipeline_name_config.yml` file pair, you can go ahead and run the pipeline from the command line instead, if you prefer. With [ceci](https://github.com/LSSTDESC/ceci) installed in your environment, just run `ceci path/to/the/pipeline.yml`. Running the pipeline we've just made would look like:" ] }, { @@ -343,7 +351,7 @@ "metadata": {}, "outputs": [], "source": [ - "pwd\n" + "! ceci pipe_saved.yml" ] } ], @@ -363,7 +371,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.4" + "version": "3.11.6" }, "vscode": { "interpreter": {