Skip to content

Commit 1ac947e

Browse files
committed
Clarify
1 parent 9f2a4ce commit 1ac947e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/recipes/optional-pipeline-steps.ipynb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@
77
"source": [
88
"# Optional Pipeline Steps\n",
99
"\n",
10+
"## Background\n",
11+
"\n",
1012
"A recurring requirement, e.g., in data analysis workflows, is to have optional steps in a pipeline.\n",
1113
"This could be a chain of multiple corrections to be applied, where a user can choose to apply or skip each step.\n",
1214
"This brings two challenges.\n",
1315
"Firstly, Sciline does not provide a way to skip steps in a pipeline, since it is in conflict with the idea that a pipeline is a directed acyclic graph (DAG).\n",
1416
"Secondly, attempts to work around this limitation, e.g., by using providers that perform no operation instead of a correction, depending on a flag are hampered by cumbersome and misleading domain type naming.\n",
15-
"Adding additional corrections furthermore require access to the source code of the pipeline, which is not always practical when the pipeline is part of a library."
17+
"Adding additional corrections furthermore require access to the source code of the pipeline, which is not always practical when the pipeline is part of a library.\n",
18+
"\n",
19+
"## Solution\n",
20+
"\n",
21+
"The solution is to move away from domain types that reflect, e.g., which corrections were applied to the data.\n",
22+
"That is, instead of having `DataWithCorrection1` and `DataWithCorrection1And2`, we have use a single `CorrectedData` and a single pipeline step that applies all corrections."
1623
]
1724
},
1825
{
@@ -112,6 +119,18 @@
112119
"While there is an upfront cost to this, it will allow pipeline users to not only select between the pre-defined corrections, but also add new corrections or combinations of corrections to the pipeline.\n",
113120
"The limitation is that these corrections will all be applied at the same point in the pipeline, unless the pipeline author has foreseen this by allowing for different correction stages in the pipeline."
114121
]
122+
},
123+
{
124+
"cell_type": "markdown",
125+
"id": "6",
126+
"metadata": {},
127+
"source": [
128+
"## Variants\n",
129+
"\n",
130+
"A variant of the above approach is to use a single function that can apply all given corrections.\n",
131+
"The selection of corrections is then done by inserting one of a set of providers that collect the desired corrections.\n",
132+
"This is similar to the approach above, but allows for better control and less duplication of the code that applies the corrections."
133+
]
115134
}
116135
],
117136
"metadata": {

0 commit comments

Comments
 (0)