Skip to main content

Constructing a Task (Electron) GoToimage

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:

  1. Define a function to perform a task.
def quadrature(x, y):
return sqrt(x**2 + y**2)
  1. Attach the @electron decorator.
@ct.electron
def quadrature(x, y):
return sqrt(x**2 + y**2)

See Also

Constructing a Lattice