Executing an Individual Task (Electron)#

Prerequisites#

Start the Covalent services.

Procedure#

To execute an individual electron:

  1. Decorate it with a @lattice decorator as shown below. (Note that the @lattice decorator is applied “atop” or “around” the task’s @electron decorator.)

[1]:
import covalent as ct

@ct.lattice
@ct.electron
def product(x, y):
    return x * y
  1. Dispatch the lattice:

[2]:
dispatch_id = ct.dispatch(product)(2, 3)
print(dispatch_id)
7e7c1440-8beb-4f3f-9252-9b43d508bf61

Executing the individual electron returns a dispatch ID that can be used to query the electron’s computation result. This is a useful technique for testing an individual electron.

See Also#

Testing an Electron