1.1 KiB
1.1 KiB
How to write a Custom Action
- Write a class inherited from mistral.actions.Action
from mistral_lib import actions class RunnerAction(actions.Action): def __init__(self, param): # store the incoming params self.param = param def run(self): # return your results here return {'status': 0}
- Publish the class in a namespace (in your
setup.cfg
)
[entry_points] mistral.actions = example.runner = my.mistral_plugins.somefile:RunnerAction
- Reinstall your library package if it was installed in system (not in virtualenv).
- Run db-sync tool to ensure your actions are in Mistral's database
$ mistral-db-manage --config-file <path-to-config> populate
- Now you can call the action
example.runner
my_workflow: tasks: my_action_task: action: example.runner input: param: avalue_to_pass_in