# 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.

[1]:

import covalent as ct

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


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

[2]:

@ct.lattice(executor="local")
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.