Dataiku Named a Gartner Magic Quadrant Leader 2 Years Running! Read More

How go get error details when scenario run_and_wait function fails

Solved!
arielma2304
Level 3
How go get error details when scenario run_and_wait function fails

Hi

I'm using this code

client = dataikuapi.DSSClient(params['host'], params['api'])
client._session.verify = False
project = client.get_project(params['project'])
scenario_id = scenario["id"]
scenario_result = project.get_scenario(scenario_id).run_and_wait()

and I see in the Junit results, the function has its own error handling:

outcome = self.scenario_run.run.get('result', None).get('outcome', 'UNKNOWN')
if outcome == 'SUCCESS' or no_fail:
   return self.scenario_run
else:
   raise DataikuException("Scenario run returned status %s" % outcome)
   dataikuapi.utils.DataikuException: Scenario run returned status FAILED

 how can I get more details about the error if I can't control it? For example, can I use here first_error_details?

get-the-first-error-that-happened-in-a-scenario-run 

0 Kudos
1 Solution
AlexandreV
Dataiker
Dataiker

Hi,
another possibility is to use

 

scenario_result = project.get_scenario(scenario_id).run_and_wait(no_fail=True)

 

and then get the result in 

 

scenario_result.run["result"]

 

Hope it helps, otherwise can you tell me a bit more about what error details you need, or what control you need overrun_and_wait()?

Best,

Alex

 


View solution in original post

0 Kudos
4 Replies
AlexandreV
Dataiker
Dataiker

Hi,

You can indeed use first_error_details as described in Get the first error that happened in a scenario run .
Another way to get more info would be to go to the Jobs tab in DSS, in your project.

Alex

0 Kudos
arielma2304
Level 3
Author

But how I can use it in Pytest if I can't control on what happens in run_and_wait() function? where exactly I can use it?

0 Kudos
AlexandreV
Dataiker
Dataiker

Hi,
another possibility is to use

 

scenario_result = project.get_scenario(scenario_id).run_and_wait(no_fail=True)

 

and then get the result in 

 

scenario_result.run["result"]

 

Hope it helps, otherwise can you tell me a bit more about what error details you need, or what control you need overrun_and_wait()?

Best,

Alex

 


View solution in original post

0 Kudos
arielma2304
Level 3
Author

Actually it does help 🙂

however, when I ran this line:

assert scenario_result.get_details()["scenarioRun"]["result"]["outcome"] == "SUCCESS", "test " + scenario["name"] + " failed" + "Error was: %s" % (scenario_result.get_details().first_error_details)

I thought I will get more details, but all I got was:

AssertionError: test TEST_always_fails failedError was: None

 I guess this is the correct behavior per DSS documentation:

"Try to get the details of the first error if this run failed. This will not always be able to find the error details (it returns None in that case)"

The question is in which cases it return not None?

 

0 Kudos
A banner prompting to get Dataiku DSS