Skip to main content

Dependencies

class covalent._workflow.deps.Deps

#

Generic dependency class used in specifying any kind of dependency for an electron.

apply_fn

function to be executed in the backend environment

apply_args

list of arguments to be applied in the backend environment

apply_kwargs

dictionary of keyword arguments to be applied in the backend environment

Methods

Encapsulates the exact function and args /kwargs to be executed in the backend environment.

apply

#

Encapsulates the exact function and args/kwargs to be executed in the backend environment.

Parameters

None

Return Type

Returns

A tuple of transportable objects containing the function and optional args/kwargs

Main Covalent public functionality.

Classes

DepsBash([commands])

Shell commands to run before an electron

DepsCall([func, args, kwargs, …])

Functions, shell commands, PyPI packages, and other types of dependencies to be called in an electron’s execution environment

DepsPip([packages, reqs_path])

PyPI packages to be installed before executing an electron

class covalent.DepsBash

#

Bases: covalent._workflow.deps.Deps

Shell commands to run before an electron

Deps class to encapsulate Bash dependencies for an electron.

The specified commands will be executed as subprocesses in the same environment as the electron.

commands

A list of bash commands to execute before the electron runs.

from_dict

#

Rehydrate a dictionary representation

Parameters

object_dict – a dictionary representation returned by to_dict

Return Type

Returns

self

Instance attributes will be overwritten.

to_dict

#

Return a JSON-serializable dictionary representation of self

Return Type

DepsBash

class covalent.DepsCall

#

Bases: covalent._workflow.deps.Deps

Functions, shell commands, PyPI packages, and other types of dependencies to be called in an electron’s execution environment

Deps class to encapsulate python functions to be called in the same execution environment as the electron.

func

A callable

args

args list

kwargs

kwargs list

retval keyword

An optional string referencing the return value of func.

If retval_keyword is specified, the return value of func will be passed during workflow execution as an argument to the electron corresp onding to the parameter of the same name.

NOTES

Electron parameters to be injected during execution must have default parameter values.

It is the user’s responsibility to ensure that retval_keyword is actually a parameter of the electron. Unexpected behavior may occur otherwise.

from_dict

#

Rehydrate a dictionary representation

Parameters

object_dict - a dictionary representation returned by to_dict

Return Type

Returns

self

Instance attributes will be overwritten.

to_dict

#

Return a JSON-serializable dictionary representation of self

Return Type

dict

Parameters

object_dict – a dictionary representation returned by to_dict

class covalent.DepsPip

#

Bases: covalent._workflow.deps.Deps

PyPI packages to be installed before executing an electron

A specification of Pip packages to be installed

packages

A list of PyPI packages to install

reqs_path

#

Path to requirements.txt (overrides packages)

These packages are installed in an electron’s execution environment just before the electron is run.

Parameters

object_dict - a dictionary representation returned by to_dict

Return Type

Returns

self

Instance attributes will be overwritten.

from_dict

#

Rehydrate a dictionary representation

Parameters

object_dict - a dictionary representation returned by to_dict

Return Type

Results

self

Instance attributes will be overwritten.

to_dict

#

Return a JSON-serializable dictionary representation of self

Return Type

dict

Examples