HPE Morpheus Enterprise
1849634 Members
6768 Online
104044 Solutions
New Discussion

Getting Task Result in Python

 
SOLVED
Go to solution
Not applicable

Getting Task Result in Python

What am I doing wrong here?

Result from task:
{‘sys_id’: ‘test123’, ‘number’: ‘123’}

Output:
{“pythonResultTest”: {}, “lastResult”: {}, “resultList”: [{}]}

Morpheus Version: v6.2.6

Thanks!

3 REPLIES 3
Ollie-Phillips
HPE Pro

Re: Getting Task Result in Python

Use json.dumps in the first task too, or output as single value rather than JSON. That should give you output.



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Not applicable

Re: Getting Task Result in Python

Thank you! json.dumps() is the key.

dgaharwar
Trusted Contributor
Solution

Re: Getting Task Result in Python

The first task should be

json_string = {"sys_id": "test123", "number": "123"} print(json.dumps(json_string))

and second task to print the result should be

print(json.dumps(morpheus['results']['taskone']))

where taskone is the code of the first task.