Testing an Electron#
You can execute an electron in a single-task workflow by simply adding a lattice decorator to the function. This technique is useful for testing and debugging individual workflow tasks in a controlled manner.
Prerequisites#
Write an electron that you want to test individually.
[1]:
import covalent as ct
@ct.electron
def add(x, y):
return x + y
Procedure#
Attach the @lattice
decorator to the electron.
[2]:
import covalent as ct
@ct.lattice
@ct.electron
def add(x, y):
return x + y
Note: Don’t confuse ct.electron(lattice)
, which creates a sublattice, with ct.lattice(electron)
, which is a workflow consisting of a single task.