Writing recipes¶
For more information about recipes, see Recipes based on code.
To start creating a recipe plugin, you have to write a “regular” Python recipe and then make it reusable:
- Go to the Advanced tab
- Click on “Convert to custom recipe”
- Select the dev plugin to add the custom recipe to
- Click on “Convert”
Recipe roles¶
Each role has the following structure:
name
: Name of the role; this is how the role is referenced elsewhere in codelabel
: A displayed name for this roledescription
: A description of what the role meansarity
: UNARY or NARY (can accept one or multiple values?)required
(boolean, default false): Does this role need to be filled?acceptsDataset
(boolean, default true)acceptsManagedFolder
(boolean, default false)
Advanced options for custom recipes¶
Select from flow view¶
To make a new recipe directly available from the Flow view when selecting a dataset:
- Edit the
recipe.json
file - Add the line
"selectableFromDataset": "main",
, wheremain
must be replaced by the name of the input role in which the selected dataset will go
The resulting file will look like:
{
"meta" : {
"label" : "My custom recipe",
"icon" : "icon-puzzle-piece"
},
"kind" : "PYTHON",
"selectableFromDataset": "main",
"inputRoles" : [
{
"name": "main",
"label": "Input dataset",
"arity": "UNARY",
"required": true,
"acceptsDataset": true
}
],
"outputRoles" : [
{
"name": "output",
"label": "Output dataset",
"arity": "UNARY",
"required": true,
"acceptsDataset": true
}
],
"params": [],
"resourceKeys" : []
}
Change icon color¶
When you use lots of custom recipes in your flows, you may want to differentiate them by color. It allows for clearer flow views and easier disctinction between different custom recipe operations.
DSS currently supports the following colors: red, pink, purple, blue, green, sky, yellow, orange, brown, grey.
You can specify the “iconColor” in the “meta” field of your recipe.json
file:
{
"meta" : {
"label": "My custom recipe",
"icon": "icon-puzzle-piece",
"iconColor": "sky"
}
}