Skip to content

Releases: latchbio/latch

v1.3.1

14 Jun 19:58
Compare
Choose a tag to compare

Fixed some dependency issues with Click + some small updates to some internal method documentation

v1.3.0

13 Jun 20:25
Compare
Choose a tag to compare

Release v1.3.0 expands the SDK to now support conditional blocks within workflows and map tasks.

Conditional Blocks

This method creates a new conditional section in a workflow, allowing a user to conditionally execute a task based on the value of a task result. Conditional sections are akin to ternary operators - they returns the output of the branch result. However, they can be n-ary with as many elif clauses as desired.

It is possible to consume the outputs from conditional nodes. And to pass in outputs from other tasks to conditional nodes.

The boolean expressions in the condition use & and | as and / or operators. Additionally, unary expressions are not allowed. Thus if a task returns a boolean and we wish to use it in a condition of a conditional block, we must use built in truth checks: result.is_true() or result.is_false()

Args:
    name: The name of the conditional section, to be shown in Latch Console

Returns:
    A conditional section

Intended Use: ::

    @workflow
    def multiplier(my_input: float, file: LatchFile) -> float:
        result_1 = double(n=my_input, file=file)
        result_2 =  (
            create_conditional_section("fractions")
            .if_((res < 0.0)).then(double(n=res, file=file))
            .elif_((res > 0.0)).then(square(file=file))
            .else_().fail("Only nonzero values allowed")
        )
        result_3 = double(n=res2, file=file)
        return result_3

Map Tasks

A map task lets you run a pod task or a regular task over a list of inputs within a single workflow node. This means you can run thousands of instances of the task without creating a node for every instance, providing valuable performance gains!

Some use cases of map tasks include:

  • Several inputs must run through the same code logic

  • Multiple data batches need to be processed in parallel

  • Hyperparameter optimization

    Args:
    task_function: The task to be mapped, to be shown in Latch Console

    Returns:
    A conditional section

    Intended Use: ::

     @task
     def a_mappable_task(a: int) -> str:
         inc = a + 2
         stringified = str(inc)
         return stringified
    
     @task
     def coalesce(b: typing.List[str]) -> str:
         coalesced = "".join(b)
         return coalesced
    
     @workflow
     def my_map_workflow(a: typing.List[int]) -> str:
         mapped_out = map_task(a_mappable_task)(a=a).with_overrides(
             requests=Resources(mem="300Mi"),
             limits=Resources(mem="500Mi"),
             retries=1,
         )
         coalesced = coalesce(b=mapped_out)
         return coalesced
    

v1.1.1

11 Jun 00:46
fabba93
Compare
Choose a tag to compare

Fixed a bug where LatchFiles/Dirs wouldn't download when initialized inside of a task.

v1.1.0

07 Jun 02:39
Compare
Choose a tag to compare
  • LatchFile/LatchDir objects can consume s3 URLs as valid paths.
  • These objects will only download data within a task context if (1) there is an implicit call to __fsopen__ (eg. open(LatchFile)) or (2) the local_path attribute is referenced.

File data will no longer be copied to task machine by default. Primarily motivated by cases when the Latch* objects are used to type fields in Records or similar complex values and only subset of fields are used/or path literal is used without desire for file data itself. We want to avoid wasted copy in such contexts.

v1.0.4

05 Jun 21:51
Compare
Choose a tag to compare

Rigorous pattern matching against project directory name + semantic error message on failure written by @CamelCaseCam

v1.0.3

30 May 22:47
Compare
Choose a tag to compare

Small patch to correctly pin lytekit dependencies

v1.0.2

30 May 22:09
Compare
Choose a tag to compare

Small patch to fix LatchFiles + LatchDirectories

v1.0.1

30 May 18:31
Compare
Choose a tag to compare

As of 5/30, the LatchBio Console will not support workflows using Union types that have been published with previous versions of the SDK. It is heavily encouraged to upgrade to this release immediately for supported behavior.

tldr; This release is required to register functional workflows with the current state of the platform.

Additional Changes

  • Base images have been reduced in size by over half (from ~900 MB to ~380MB).
  • Additional working base images for CUDA and OpenCL environments have been released and describe here

v0.11.0

29 May 16:09
Compare
Choose a tag to compare

Introduces file_glob to group files by a pattern (#68).

Using Globs

Often times logic is needed to move groups of files together based on a shared
pattern. For instance, you may wish to return all files that end with a
fastq.gz extension after a
trimming task has been run.

To do this in the SDK, you can leverage the file_glob function to construct
lists of LachFiles defined by a pattern.

The class of allowed patterns are defined as globs. It is likely you've
already used globs in the terminal by using wildcard characters in common
commands, eg. ls *.txt.

The second argument must be a valid latch URL pointing to a directory. This will
be the remote location of returned LatchFile constructed with this utility.

In this example, all files ending with .fastq.gz in the working directory of
the task will be returned to the latch:///fastqc_outputs directory:

@small_task
def task():

    ...

    return file_glob("*.fastq.gz", "latch:///fastqc_outputs")

v0.10.0

26 May 10:27
Compare
Choose a tag to compare

Release introduces local execution in container. Read more here.

Additionally an M1 Mac build patch (#64 )

In-Container Local Execution Details

$ latch local-execute myworkflowdir

This is the same as running:

    $ python3 wf/__init__.py

Assuming this file contains a snippet conducive to local execution such as:

    if __name__ == "__main___":
       my_workflow(a="foo", reads=LatchFile("/Users/Von/Neumann/machine.txt")