Constructing a Task (Electron)
An electron is a single task, the basic building block of a workflow. Construct an electron by writing a function that performs one step in a workflow.
Prerequisites
Import the Covalent library. Do this in any file you write that uses the Covalent SDK.
import covalent as ct
Procedure
To create an electron:
- Define a function to perform a task.
def quadrature(x, y):
return sqrt(x**2 + y**2)
- Attach the
@electron
decorator.
@ct.electron
def quadrature(x, y):
return sqrt(x**2 + y**2)