This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

How to store a python script output to a variable using publish in workflow scripts

Hi All,

Please help on how to store a python script output to a variable using publish in workflow scripts

Thanks,

Very simple:
for action-chain:
https://docs.stackstorm.com/actionchain.html#variables
for orquesta:
Publish your vars in Task Transition section
https://docs.stackstorm.com/orquesta/languages/orquesta.html#task-transition-model

When you use Python script as action, you must implement run() method from BaseAction class. This method’s return value can be assigned to the variable in the workflow.

https://docs.stackstorm.com/actions.html#writing-custom-python-actions
In the above example, message variable value returned from the run method will be published to a workflow variable of the same type. The syntax is like below:

publish:
        - msg: <% result().result %>

where msg being a variable declared in the orchesta workflow.

Thank you @bryan and @arms11 .