Skip to content

Commit

Permalink
Merge pull request #121 from LSSTDESC/issue/119/mention-ceci
Browse files Browse the repository at this point in the history
Add short description of running pipelines with ceci command line
  • Loading branch information
OliviaLynn committed Dec 23, 2023
2 parents e015e13 + 2176854 commit 65ad9df
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions examples/core_examples/Build_Save_Load_Run_Pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"**Author:** Eric Charles\n",
"\n",
"**Last Run Successfully:** August 2, 2023"
"**Last Run Successfully:** December 22, 2023"
]
},
{
Expand Down Expand Up @@ -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"
]
},
{
Expand All @@ -64,7 +64,7 @@
"outputs": [],
"source": [
"DS = RailStage.data_store\n",
"DS.__class__.allow_overwrite = True\n"
"DS.__class__.allow_overwrite = True"
]
},
{
Expand Down Expand Up @@ -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)]"
]
},
{
Expand Down Expand Up @@ -147,7 +147,7 @@
"\n",
"table_conv_test = TableConverter.make_stage(\n",
" name=\"table_conv_test\", output_format=\"numpyDict\", seed=12345\n",
")\n"
")"
]
},
{
Expand All @@ -156,7 +156,7 @@
"metadata": {},
"outputs": [],
"source": [
"flow_engine_test.sample(6, seed=0).data\n"
"flow_engine_test.sample(6, seed=0).data"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -198,7 +198,7 @@
"outputs": [],
"source": [
"# Get the names of the stages\n",
"pipe.stage_names\n"
"pipe.stage_names"
]
},
{
Expand All @@ -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"
]
},
{
Expand All @@ -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"
]
},
{
Expand All @@ -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"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -278,7 +278,7 @@
"source": [
"pipe.initialize(\n",
" dict(model=flow_file), dict(output_dir=\".\", log_dir=\".\", resume=False), None\n",
")\n"
")"
]
},
{
Expand All @@ -300,7 +300,7 @@
"metadata": {},
"outputs": [],
"source": [
"pipe.save(\"pipe_saved.yml\")\n"
"pipe.save(\"pipe_saved.yml\")"
]
},
{
Expand All @@ -316,7 +316,7 @@
"metadata": {},
"outputs": [],
"source": [
"pr = ceci.Pipeline.read(\"pipe_saved.yml\")\n"
"pr = ceci.Pipeline.read(\"pipe_saved.yml\")"
]
},
{
Expand All @@ -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:"
]
},
{
Expand All @@ -343,7 +351,7 @@
"metadata": {},
"outputs": [],
"source": [
"pwd\n"
"! ceci pipe_saved.yml"
]
}
],
Expand All @@ -363,7 +371,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.6"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 65ad9df

Please sign in to comment.