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.

[1]:
import covalent as ct

Procedure#

To create an electron:

  1. Define a function to perform a task.

[2]:
def quadrature(x, y):
    return sqrt(x**2 + y**2)
  1. Attach the @electron decorator.

[3]:
@ct.electron
def quadrature(x, y):
    return sqrt(x**2 + y**2)

See Also#

Constructing a Lattice