How to add bash dependencies to an electron#

In this section, we show the required steps to specify a list of bash dependencies in an electron. First, we import covalent.

[1]:
import covalent as ct

Next, we pass in the list of comma-separated bash commands as an argument to DepsBash()

[2]:
@ct.electron(
        deps_bash=ct.DepsBash(["echo $PATH >> /tmp/path.txt"]),
)
def get_bash_result():
    with open('/tmp/path.txt','r') as f:
        return f.read()

We can also specify list of bash commands in the electron in implicit form.

[3]:
@ct.electron(
        deps_bash=["echo $PATH >> /tmp/path.txt"],
)
def get_bash_result():
    with open('/tmp/path.txt','r') as f:
        return f.read()
[ ]:
@ct.lattice
def workflow():
    return get_bash_result()

dispatch_id = ct.dispatch(workflow)()
r = ct.get_result(dispatch_id, wait=True)
print(r.result)