Executing a Workflow (Lattice)#

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


  1. Start the Covalent services.

  2. 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)


Submit the workflow using the dispatch() method:

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

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

[ ]: