From 242cd15dba0e6c8598e3ea2b8d0ab14abd8bc62f Mon Sep 17 00:00:00 2001 From: AidanAbd Date: Thu, 4 May 2023 16:20:02 -0400 Subject: [PATCH] fix: small fixes for conda template --- CHANGELOG.md | 7 ++++++ latch_cli/docker_utils/__init__.py | 2 -- .../services/init/example_conda/conda_task.py | 24 ++++++++++--------- setup.py | 2 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f2ef972..d832aeee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,13 @@ Types of changes *Security* in case of vulnerabilities. --> +# Latch SDK Changelog + +## 2.19.4 - 2023-05-04 + +### Fixed + +- Conda template registration issue and run in correct environment issue # Latch SDK Changelog diff --git a/latch_cli/docker_utils/__init__.py b/latch_cli/docker_utils/__init__.py index 8c59e5ef..9f81b0e5 100644 --- a/latch_cli/docker_utils/__init__.py +++ b/latch_cli/docker_utils/__init__.py @@ -128,8 +128,6 @@ def infer_commands(pkg_root: Path) -> List[DockerCmdBlock]: commands=[ "copy environment.yaml /opt/latch/environment.yaml", f"run conda env create --file /opt/latch/environment.yaml --name {env_name}", - f'shell ["conda", "run", "--name", "{env_name}", "/bin/bash", "-c"]', - "run pip install --upgrade latch", ], order=DockerCmdBlockOrder.precopy, ), diff --git a/latch_cli/services/init/example_conda/conda_task.py b/latch_cli/services/init/example_conda/conda_task.py index 96481d61..12dc7a6e 100644 --- a/latch_cli/services/init/example_conda/conda_task.py +++ b/latch_cli/services/init/example_conda/conda_task.py @@ -2,24 +2,26 @@ from latch import small_task from latch.types import LatchFile, LatchOutputDir +from typing import List +def run(command: List[str], check: bool = True, capture_output: bool = False): + + cmd = ["conda", "run", "--name", "example", "/bin/bash", "-c", " ".join(command)] + + return subprocess.run(cmd, check=check, capture_output=capture_output) # change the name of this function to something more descriptive @small_task def conda_task(input_file: LatchFile, output_directory: LatchOutputDir) -> LatchFile: # You can run conda packages as a subprocess: - subprocess.run( - "".join( - [ - "put", - "conda", - "command", - "here", - ] - ), - check=True, - shell=True, + run( + [ + "put", + "conda", + "command", + "here", + ] ) ... output_location = f"{output_directory.remote_directory}/YOUR_OUTPUT_FILE_NAME" diff --git a/setup.py b/setup.py index 3e15c1af..b3652f5b 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setup( name="latch", - version="v2.19.3", + version="v2.19.4", author_email="kenny@latch.bio", description="The Latchbio SDK", packages=find_packages(),