Submodules# module# str)[source]#

Allows a user to start an interactive shell session in the remote machine that a task is running on.

When running a workflow on Latch, its often helpful while debugging to have a direct way of interacting with the machines on which tasks are run. Using execute, a user can easily get a shell into the machine on which the specified task is running.


task_name – The name of the running task you want a shell into. This is a hash that can be found in the sidebar in the browser display of the running workflow.


>>> execute("abcd1234-n0")
    root@$ module#

Service to get workflows. Optional[str] = None)[source]#

Get a list of a workflow’s versions.

This will allow users to list all owned workflows by default. Optionally, a user can provide a workflow name (unique with respect to a user) to list all versions of the specific workflow.


wf_name – The name of the workflow.


>>> get_wf("wf.__init__.alphafold_wf")
    ID      Name                            Version
    61858   wf.__init__.alphafold_wf        v2.1.0+14
    67261   wf.__init__.alphafold_wf        v2.2.3+0
    67317   wf.__init__.alphafold_wf        v2.2.3+14
    67341   wf.__init__.alphafold_wf        v2.2.3+19
    67408   wf.__init__.alphafold_wf        v2.2.3+40
    ... module#[source]#

Open an interactive terminal user interface that shows all executions for a particular user on Latch.

This function in many ways mimics the interface at but in a terminal. You may scroll around using either the arrow keys (or [HJKL] if you like Vim) and you can hit [ENTER] to see more information about the selected execution. You can see logs, and abort a running execution.

This function should only be called from the CLI, as doing so in any other setting will likely cause the interface to behave in an unexpected way. module# str, wf_version: Optional[str] = None)[source]#

Constructs a parameter map for a workflow given its name and an optional version.

This function creates a python parameter file that can be used by launch. You can specify the specific parameters by editing the file, and then launch an execution on Latch using those parameters with launch.

  • wf_name – The unique name of the workflow.

  • wf_version – An optional workflow version. If this argument is not given, get_params will default to generating a parameter map of the most recent version of the workflow.


>>> get_params("wf.__init__.alphafold_wf")
    # creates a file called `` that
    # contains a template parameter map. module#

Service to launch a workflow. pathlib.Path, version: Optional[str] = None) str[source]#

Launches a (versioned) workflow with parameters specified in python.

Using a parameter map written in python (this can be generated for you with get_params), this function will launch the workflow specified in the file using the parameters therein. This function also accepts an optional version parameter to further specify the workflow to be run. If it is not provided, this function will default to running the latest version of the specified workflow.

  • params_file – A path pointing to a python parameter file containing a function call that represents the workflow execution with valid parameter values.

  • version – An optional workflow version to launch, defaulting to the latest if not provided.


The name of the workflow.


>>> launch(Path(""))
    # Launches an execution of `wf.__init__.assemble_and_sort` with the
    # parameters specified in the referenced file. module# pathlib.Path)[source]#

Starts a REPL that allows a user to interactively run tasks to help with debugging during workflow development.

In this REPL, you can run tasks or scripts and make edits to them without having to reregister your workflow. You can also get a shell into a container with the same environment as the one that the workflow runs in, to help debug installation issues. See the full documentation for Local Development for more info.

Like get_executions, this should only be called from the CLI for best results.


pkg_root – A path that points to a valid workflow directory (see the docs for register) module#

Service to login. Optional[str] = None) str[source]#

Authenticates a user with Latch and persists an access token.

Kicks off the three-legged OAuth2.0 flow outlined in this RFC. The logic scaffolding this flow and detailed documentation about it can be found in the latch.auth package.

The user will be redirected to a browser and prompted to login. This function meanwhile spins up a callback server on a separate thread that will be hit when the browser login is successful with an access token. module#

Service to list files in a remote directory. str) List[Dict[str, str]][source]#

Lists the remote entities inside of a remote_directory


remote_directory – A valid path to a remote destination, of the form [latch://]/dir_1/dir_2/.../dir_n/dir_name, where dir_name is the name of the directory to list under. Every directory in the path must already exist.

This function will list all of the entites under the remote directory specified in the path remote_directory. Will error if the path is invalid or the directory doesn’t exist.


>>> ls("")
    # Lists all entities in the user's root directory
>>> ls("latch:///dir1/dir2/dir_name")
    # Lists all entities inside dir1/dir2/dir_name module# str, dest: str)[source]# module# str)[source]#

Opens a console URL in the browser corresponding to a remote path

This function will open the specified file in console on the user’s browser. It will error if the path is invalid, the file doesn’t exist, or if the path points to a directory.


remote_file – A valid path to a remote destination, of the form [latch://] [/] dir_1/dir_2/.../dir_n/filename, where filename is the name of a file.


>>> open("sample.txt") # sample.txt exists
    # Opens the file sample.txt in the user's browser.
>>> open("latch:///dir1/dne/sample.txt") # dne does not exist
    # Will throw an error, as we cannot open a file that does not exist.
>>> open("/dir1/dir2") # dir1/dir2 is a directory
    Will throw an error, as this operation tries to open a directory module# pathlib.Path)[source]#

Generate a preview of the parameter interface for a workflow.

This will allow a user to see how their parameter interface will look without having to first register their workflow.


pkg_root – A valid path pointing to the worklow code a user wishes to preview. The path can be absolute or relative.


>>> preview("wf.__init__.alphafold_wf") module#[source]#

Opens a terminal user interface in which a user can select the workspace the want to switch to.

Like get_executions, this function should only be called from the CLI.

Module contents#

Services or actions exposed through the SDK.

Services take one or more domain objects and/or values and perform some transformation. These are the actions a user will interact with through the CLI, eg. to “register” a workflow given login context.