Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture and return output from Bash Leptons #1857

Open
araghukas opened this issue Nov 21, 2023 · 0 comments
Open

Capture and return output from Bash Leptons #1857

araghukas opened this issue Nov 21, 2023 · 0 comments
Assignees
Labels
feature New feature addition Team Psi - BE Covalent Team Psi BE Team Psi Covalent Team Psi

Comments

@araghukas
Copy link
Contributor

araghukas commented Nov 21, 2023

What should we add?

Make things like this work by capturing stdout from the command, or returning None or '' (empty string) if there is no output.

(As is, the workflow below fails on second with "NoneType has no attribute split".)

import covalent as ct

@ct.leptons.bash(display_name="Run a bash script")
def list_cwd():
    return "ls -lth"

@ct.electron
def break_into_lines(output: str):
    return output.split("\n")

@ct.lattice
def workflow():
    return break_into_lines(list_cwd())

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

Describe alternatives you've considered.

No response

@araghukas araghukas added feature New feature addition Team Psi Covalent Team Psi Team Psi - BE Covalent Team Psi BE labels Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature addition Team Psi - BE Covalent Team Psi BE Team Psi Covalent Team Psi
Projects
None yet
Development

No branches or pull requests

4 participants