Querying Workflow (Lattice) Execution Status in a Notebook#

Once you have dispatched a workflow, use the Covalent Result object to check run status of the lattice programmatically. You can also check the status of individual electrons.


Define and run a workflow:

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)

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


  1. Retrieve the result object using the dispatch ID with the ct.get_result() function.

To retrieve the result only once the computation is completed, set wait=True. Otherwise, set wait=False.

result = ct.get_result(dispatch_id=dispatch_id, wait=False)
  1. The dispatch status is maintained in the status attribute of the result object. While the computations are running, the status is RUNNING:

  1. The result object is updated continuously until the workflow is finished. The final status can be one of several values, including COMPLETED, FAILED, and CANCELED.

To check the computation status again, re-retrieve the results object:

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

See Also#

Querying Task (Electron) Status in a Notebook

Running a Workflow

Querying Lattice Execution Time