More control over the execution flow

Sometimes, recipes do not include enough information to be correctly executed.

Flags and filters

Sometime, types does not carry enough information to choose which items should be used as inputs. Tags intend to solve this.

As an example, let’s consider a install task which take one argument typed “project”. If you want to manager this project dependence, you are likely to have more than one item typed “project”. In this situation, the execution manager will not be able to choose which project should be used as input for the install task.

Tags to the rescue! In this case it is possible to tag the directory as #main-project in the recipe so the task manager will know which input to select.

Tags alone are useless, they must used in addition of inputs filters.

The idea between filters is to make the choice of inputs more accurately.

In order to filter, you must precise which tags the item must have in order to be selected. Filters are applied to specific input.

Example

Let’s take the same example of the install task, we should have this kind of code:

from goatlib import Task

class InstallTask(Task):

        category = "install"

        inputs = {"project" : "project"}

        def __call__(self, project):
                ...

And we will this kind of recipe:

{"recipe":
        [{"task-category": "install"}],
 "tasks":
        ["InstallTask"]
}

And if you want to filter the project input to select only item tagged “main”, you will write this recipe instead:

{"recipe":
        [{"task-category": "install",
          "input-filters" : {"project" : ["main"]}}],
 "tasks":
        ["InstallTask"]
}

Project Versions

Table Of Contents

Previous topic

Create your own tasks and recipe

Next topic

Exemples

This Page