Skip to content

v0.8.0

Compare
Choose a tag to compare
@kennyworkman kennyworkman released this 07 May 21:11
· 2604 commits to main since this release

Local Development

Here is an example of a minimal wf/__init__.py file that demonstrates local
execution:

from pathlib import Path

from latch import small_task, workflow
from latch.types import LatchFile


@small_task
def foo(a: LatchFile) -> LatchFile:

    with open(a) as f:
        print(f.read())

    b = Path("new.txt").resolve()
    with open(b, "w") as f:
        f.write("somenewtext")

    return LatchFile(str(b), "latch:///remote_location/a.txt")


@workflow
def bar(a: LatchFile) -> LatchFile:
    """
    ...
    """
    return foo(a=a)


if __name__ == "__main__":
    bar(a=LatchFile("/root/reads.fa"))

Read more at https://docs.latch.bio/basics/local_development.html