# How to query a lattice execution status#

Let us first define a workflow that performs a simple task.

[1]:

import time

import covalent as ct

@ct.electron
return x + y

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

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


Next, we dispatch the workflow for some parameters.

[2]:

dispatch_id = ct.dispatch(workflow)(x=2, y=3)


Next, we query the result object using the dispatch id using ct.get_result.

[3]:

result = ct.get_result(dispatch_id=dispatch_id, wait=False)


Tip

If we want to only retrieve the result when the computation is completed, we set wait=True. Otherwise, we set wait=False.

As we can see below, while the computations are running, the status is RUNNING.

[4]:

print(result.status)

RUNNING


If we want to check the computation status again, it is very important that we re-retrieve the results object.

[5]:

result = ct.get_result(dispatch_id=dispatch_id, wait=True)
print(result.status)

RUNNING