Skip to content

Commit

Permalink
use container_workdir as workdir if supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldesai1 committed Jan 17, 2024
1 parent 4ff6d1c commit ff255ac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions latch_cli/snakemake/single_task_snakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,14 @@ def get_docker_cmd(
if envvars:
docker_cmd += " " + " ".join(f"-e {k}={v}" for k, v in envvars.items())

workdir = container_workdir or "/latch"
docker_cmd += " -w {}".format(workdir)

# support for containers currently only works with relative input and output paths
# this preserves the behavior before the monkey path
docker_cmd += " -v .:/latch"
docker_cmd += " -v .:{}".format(workdir)

docker_cmd += " {} {} {} -c 'cd /latch; {}'".format(
docker_cmd += " {} {} {} -c '{}'".format(
args, img_path, shell_executable, cmd.replace("'", r"'\''")
)

Expand All @@ -331,8 +334,7 @@ def get_docker_cmd(
def docker_path(self):
parsed = urlparse(self.url)
if parsed.scheme != "" and parsed.scheme != "docker":
print("Only docker images are supported.")
sys.exit(1)
raise ValueError("Only docker images are supported")
return parsed.netloc + parsed.path


Expand Down

0 comments on commit ff255ac

Please sign in to comment.