Sending an email report from scenario using variables from the scenario

Solved!
ArvinUbhi
Level 3
Sending an email report from scenario using variables from the scenario

From within a python script scenario within a DSS environment, I am accessing other DSS environments using the set_remote_dss method to gather infomation on active scenario triggers. At the end of gathering the relavent infomation from the different environments, I coalate them into a pandas DataFrame and construct a string with the html id like to send in an email. However, when I try to send an email within the Pyhton script by setting the message sender to the correct channel adn sending the email using .send(params) and providing the correct params, I seem to be getting the following error:

  File "/data0/dss-install/dataiku-dss-8.0.2/python/dataiku/core/intercom.py", line 449, in _handle_json_resp    
raise Exception("%s: %s" % (err_msg, _get_error_message(err_data).encode("utf8")))
Exception: None: Ticket not given or unrecognized

Also the I am setting the Scenario instance for the current scenario in the current DSS env at the start before I use the set_remote_dss method. This is used to send the email.

If I remove the set_remote_dss call, this works perfectly however it defeats the point in my project. Effectively what I am asking is how to I fix this error or use the email reporter within dss to send an email which can use the html that I formulate within my python script scenario?

0 Kudos
1 Solution
MarcH
Dataiker

Hello,

The set_remote_dss() method will have cached some location data pointing to the remote DSS, so when you then call send(), it will still be trying to contact the remote DSS, and not the local DSS, which is what you want. Just before calling send(), can you please try adding the following line to clear the cached location data:

dataiku.intercom._cached_location_data = None

 

View solution in original post

1 Reply
MarcH
Dataiker

Hello,

The set_remote_dss() method will have cached some location data pointing to the remote DSS, so when you then call send(), it will still be trying to contact the remote DSS, and not the local DSS, which is what you want. Just before calling send(), can you please try adding the following line to clear the cached location data:

dataiku.intercom._cached_location_data = None