How to query the result of electron execution#

Once a workflow has been orchestrated and dispatched (shown below), we can query the result of each electron execution.

[1]:
import covalent as ct

@ct.electron
def add(x, y):
    return x + y

@ct.electron
def multiply(x, y):
    return x * y

@ct.lattice
def workflow(x, y):
    res_1 = add(x=x, y=y)
    return multiply(x=res_1, y=y)

dispatch_id = ct.dispatch(workflow)(x=2, y=3)
result = ct.get_result(dispatch_id=dispatch_id, wait=True)

Tip

Use ct.get_result to query the results.

Once, we have the result object, we can query the result of each electron execution using the get_all_node_ouputs() method as shown below.

[2]:
result.get_all_node_outputs()
[2]:
{'add(0)': 5,
 ':parameter:2(1)': 2,
 ':parameter:3(2)': 3,
 'multiply(3)': 15,
 ':parameter:3(4)': 3}