Skip to content

Handling output files generated inside an electron #1627

Discussion options

You must be logged in to vote

EDIT: See #1628 and the PRs linked therein for an updated answer!

@santoshkumarradha's answer was:

When manually reading or writing files within Covalent, it's always a good practice to use absolute paths. By doing so, you can avoid potential confusion or issues related to file handling.

Here's an example that demonstrates the use of absolute paths in a Covalent workflow:

import covalent as ct
from pathlib import Path

@ct.electron
def job(val1, val2,file):
    with open(file, "w") as w:
        w.write(str(val1 + val2))
    return "Done!"

@ct.lattice
def workflow(input_file, val1, val2, val3, val4):
    job1 = job(val1, val2,input_file)
    return job1

input_file = Path("./example1.txt").

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Andrew-S-Rosen
Comment options

@santoshkumarradha
Comment options

Answer selected by Andrew-S-Rosen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants