assembly_task
, as well
as another task we can assume was defined elsewhere, sort_bam_task
.
You must not write actual logic in the workflow function body. It can only be
used to call task functions and pass task function return values to downstream
task functions. Additionally all task functions must be called with keyword
arguments. You also cannot access variables directly in the workflow function;
in the example below, you would not be able to pass in read1=read1.local_path
.
Workflow Code Structure
So far we have defined workflows and tasks as python functions but we don’t know where to put them or what supplementary files might be needed to run the code on the Latch platform. Workflow code needs to live in directory with three necessary elements:- a file named
Dockerfile
that defines the computing environment of your tasks - a file named
version
that holds the plaintext version of the workflow - a directory named
wf
that holds the python code needed for the workflow. - task and workflow functions must live in a
wf/__init__.py
file
latch init myworkflow
to construct a directory structured as above for
reference or boilerplate.
Example Dockerfile
Note: you are required to use our base image for the time being.
Example version
File
You can use any versioning scheme that you would like, as long as each register
has a unique version value. We recommend sticking with semantic
versioning.
Example wf/__init__.py
File
What happens at registration?
Now that we’ve defined our functions, we are ready to register our workflow with the LatchBio platform. This will give us:- a no-code interface
- managed cloud infrastructure for workflow execution
- a dedicated API endpoint for programmatic execution
- hosted documentation
- parallelized CSV-to-batch execution
latch register <directory_name>
into our terminal (where
directory_name is the name of the directory holding our code, Dockerfile and
version file).
The registration process requires a local installation of Docker.
To re-register changes, make sure you update the value in the version file. (The
value of the version is not important, only that it is distinct from previously
registered versions).