0 votes

Can I use a project variable in the message sent out at the end of a scenario by a slack web hook.

 

More context because I feel I'm doing something convoluted (hence probably not the simplest way to do it) :

In one project the 'final' recipe executes some functional action.

I set a project level variable summarizing some infos on the run like this. This is the final line of code at the end of a scenario run.

(python code in the recipe)

dataiku.api_client().get_project('THISISAPROJECTNAME').set_variables({'local':{'reportmessages':message2report},'standard':{}})

On the scenario , I set a slack webhook as a 'reporter'

on the text to display :

Reporting on SomeRun
Vouchers sent via somesend
${scenarioName}:${triggerType}
Results : ${outcome}

and would like to add  Message: ${reportmessages}  something like this


Thanks for any pointers !
 

 

asked by

1 Answer

0 votes

Hi,

On the latest version of DSS, you can directly set a project variable, for instance:

And use it in your scenario reporter using the $ magic ${foo}. This will return "bar" :)

In your case, if there is a scenario step to define and reset the project variable " reportmessages" , you will indeed reference it with ${reportmessages} inside the scenario reporting screen.

Cheers,

Alex

 

answered by
Would it be the way you recommend to get a string passed *from inside a  recipe code *  to a slack chan through report message ?
 do you see any other way to do it ?
It may be better to do the variable set in a Python scenario step so that it is monitored in the scenario log. That assumes you have Automation features activated. If not, you can do it in a recipe, there is nothing wrong with that.
thx. I'll try this.
792 questions
816 answers
720 comments
533 users