Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
#66: Initial docs for pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Aug 27, 2021
1 parent 54ea637 commit 0ed73f2
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Keep learning
syntax
usage/importing-tasks
extending-tasks
pipelines
project-structure
usage/index
standardlib/index
Expand Down
61 changes: 61 additions & 0 deletions docs/source/pipelines.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Pipelines
=========

Pipeline is a set of Tasks executing in selected order, with optional addition of error handling.


@error
------

Executes a Task or set of Tasks when error happens. Does not affect the final result. After error task is finished the whole execution is stopped, no any more task will execute.

**Syntax:**

.. tabs::

.. tab:: YAML

.. code:: yaml
version: org.riotkit.rkd/yaml/v2
pipelines:
:upgrade:
- task: ":db:backup"
- task: ":db:stop"
- block:
error: [':notify', '--msg="Failed"']
tasks:
- task: [':db:migrate']
- task: [":db:start"]
- task: [":notify", '--msg', 'Finished']
.. tab:: Python

.. code:: python
from rkd.core.api.syntax import Pipeline, PipelineTask as Task, PipelineBlock as Block, TaskDeclaration
from rkd.core.standardlib.core import DummyTask
from rkd.core.standardlib.shell import ShellCommandTask
# ...
PIPELINES = [
Pipeline(
name=':upgrade',
description='Example',
to_execute=[
Task(':db:backup'),
Task(':db:stop'),
Block(error=':notify --msg="Failed"', tasks=[
Task(':db:migrate')
]),
Task(':db:start'),
Task(':notify', '--msg', 'Finished')
]
)
]
**Example workflow:**

.. image:: rkd-pipeline-error.png

Binary file added docs/source/rkd-pipeline-error.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/rkd-pipeline-rescue.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/rkd-pipeline-retry-block.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/rkd-pipeline-retry.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/standardlib/technical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ to create a task by defining a simple method as a callback.

.. literalinclude:: ../../examples/callback/.rkd/makefile.py

.. autoclass:: rkd.standardlib.CallableTask
.. autoclass:: rkd.core.standardlib.CallableTask
:members:

:rkd:create-structure
Expand All @@ -57,7 +57,7 @@ It was designed to allow to create customized installers for tools based on RKD

Look for "interface methods" in class code, those methods are guaranteed to not change from minor version to minor version.

.. autoclass:: rkd.standardlib.CreateStructureTask
.. autoclass:: rkd.core.standardlib.CreateStructureTask
:members:

:file:line-in-file
Expand Down

0 comments on commit 0ed73f2

Please sign in to comment.