How to execute a given lattice#

In order to execute a given lattice, first construct a workflow using the lattice decorator.

import covalent as ct

def identity(x):
    return x

def square(x):
    return x * x

def workflow(a):
    val_1 = identity(x=a)
    return square(x=val_1)


Ensure that Covalent services have been started before attempting to execute the lattice.

Following that, the workflow can now be submitted using the dispatch method.

dispatch_id = ct.dispatch(workflow)(a=2)

When the workflow is dispatched, a dispatch id is generated. This id is then used to query the status of the task and retrieve the results as discussed in How to query electron execution result and How to query lattice execution result.