Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

With

sapi

gapi.py (project manager)

Info

Available since version 0.5

Rename in version 3.0 from sapi to gapi

On the root of the GAIA API project execute on the terminal the following command:

Code Block
languagebash
python gapi.py new pipeline <name>

This will generate a bare minimum pipeline with all the steps and changes view on the manual section



Table of Contents

Warning

Documentation below does not apply for version >= 3.0.0

Manual

Use this section if sapigapi.py is not available in your version

1) Create the pipeline file

  • Start by creating a python file for the pipeline configuration in the folder config/pipeline

    Tip

    A descriptive name works the best





On The File



2) Import the Pipeline class and stages

  • All stages should be in the package app.pipeline.stages
  • Pipeline class is in app.pipeline
Code Block
languagepy
themeDJango
from app.pipeline import Pipeline
from app.pipeline.stages import DemoStage

3) Declare a Variable  & Generate an Instance of Each Stage

  • The parameters of the stage may require to import other clases
Code Block
languagepy
themeDJango
_demo = DemoStage(
    enable=True,
    name='demo',
    save_to_intermediate=False,
    expand_result=False,
    ui_only=None,
    halt_on_exception=False
)

4) Define the PIPELINE Variable and Assign an Instance of the Pipeline Class

  • Pipeline class has 2 required parameters
    1. Enable: default true, if false pipeline will not load
    2. Stages: all the stages in the order to execute
Code Block
languagepy
themeDJango
PIPELINE = Pipeline(
    enable=True,
    stages=[
        _demo
    ]
)

5) Verify Pipeline Status

  • Starting the server check the logs for the entry loading the pipeline
  • In case of error, the logs will show the issue
    • Either unable to load the pipeline or unable to initialize it
    • Otherwise you should see Pipeline <name> loaded
  • You can go to /es/docs and execute the GET pipeline endpoint and see if the name appears