How to add constraints to lattices#

We can assign specifications or constraints for the execution of the workflows. One such constraint is the setting of the executor which is to be used for each task. In order to see how constraints can be added to lattices, let us first define a simple subtask.

import covalent as ct

def identity(x):
    return x

Next, we construct a workflow with the lattice decorator and pass in the constraints of interest as arguments.

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

In this example, we overrode the default executor for each task (electron) in the workflow (there is only one task in this example), instead of specifying an executor for the task.