How to query a lattice execution status#

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

import time

import covalent as ct

def add(x, y):
    return x + y

def multiply(x, y):
    return x * y

def workflow(x, y):
    res_1 = add(x=x, y=y)
    return multiply(x=res_1, y=y)

Next, we dispatch the workflow for some parameters.

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

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

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


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.


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

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