Skip to content

Commit 528b6c8

Browse files
committed
Add docs for onetime pipeline
Signed-off-by: Keshav Priyadarshi <[email protected]>
1 parent 68c0802 commit 528b6c8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/source/tutorial_add_importer_pipeline.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ At this point, an example importer will look like this:
152152
.. code-block:: python
153153
:caption: vulnerabilities/pipelines/example_importer.py
154154
:linenos:
155-
:emphasize-lines: 16-17, 20-21, 23-24
155+
:emphasize-lines: 17-18, 21-22, 24-25
156156
157157
from vulnerabilities.pipelines import VulnerableCodeBaseImporterPipeline
158158
@@ -165,6 +165,7 @@ At this point, an example importer will look like this:
165165
license_url = "https://exmaple.org/license/"
166166
spdx_license_expression = "CC-BY-4.0"
167167
importer_name = "Example Importer"
168+
run_once = False
168169
169170
@classmethod
170171
def steps(cls):
@@ -196,7 +197,7 @@ version management from `univers <https://github.com/aboutcode-org/univers>`_.
196197
.. code-block:: python
197198
:caption: vulnerabilities/pipelines/example_importer.py
198199
:linenos:
199-
:emphasize-lines: 34-35, 37-40
200+
:emphasize-lines: 35-36, 38-41
200201
201202
from datetime import datetime
202203
from datetime import timezone
@@ -223,6 +224,7 @@ version management from `univers <https://github.com/aboutcode-org/univers>`_.
223224
license_url = "https://example.org/license/"
224225
spdx_license_expression = "CC-BY-4.0"
225226
importer_name = "Example Importer"
227+
run_once = False
226228
227229
@classmethod
228230
def steps(cls):
@@ -303,6 +305,17 @@ version management from `univers <https://github.com/aboutcode-org/univers>`_.
303305
Implement ``on_failure`` to handle cleanup in case of pipeline failure.
304306
Cleanup of downloaded archives or cloned repos is necessary to avoid potential resource leakage.
305307

308+
.. tip::
309+
310+
Set ``run_once`` to ``True`` if pipeline is meant to be run once.
311+
312+
- To rerun onetime pipeline, reset ``is_active`` to ``True`` via a migration, pipeline will
313+
run one more time and then deactivate.
314+
315+
- To convert a onetime pipeline to a regular pipeline, set the ``run_once`` class variable
316+
to ``False`` and reset ``is_active` field to ``True`` via a migration.
317+
318+
306319
.. note::
307320

308321
| Use ``make valid`` to format your new code using black and isort automatically.

0 commit comments

Comments
 (0)