How to execute a given lattice#
In order to execute a given lattice, first 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)
Note
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.
[2]:
dispatch_id = ct.dispatch(workflow)(a=2)
print(dispatch_id)
[2]:
'64499b38-4c25-41f3-9555-49c40d369992'
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.