Executing a Workflow (Lattice)#

To execute a lattice, use the Covalent dispatch() function.

Prerequisites#

  1. Start the Covalent services.

  2. Construct a workflow using the @lattice decorator:

[1]:
import covalent as ct

@ct.electron
def identity(x):
    return x

@ct.electron
def square(x):
    return x * x

@ct.lattice
def workflow(a):
    val_1 = identity(x=a)
    return square(x=val_1)

Procedure#

Submit the workflow using the dispatch() method:

[2]:
dispatch_id = ct.dispatch(workflow)(a=2)
print(dispatch_id)
19616db4-6b26-47ee-b340-449e51e606d7

When the server dispatches a workflow, it generates a dispatch ID. Use the ID to query the status of the task and retrieve the results as discussed in Querying the Status of an Electron and Querying the Status of a Lattice.

See Also#

Constructing a Task (Electron)

Constructing a Workflow (Lattice)

Adding an Electron to a Lattice

Managing the Covalent Server

Querying the Status of an Electron

Querying the Status of a Lattice