Skip to content

Commit

Permalink
fix: prevent name collisions on input parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
rahuldesai1 committed Dec 30, 2023
1 parent e9fdcb0 commit 947a877
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions latch_cli/snakemake/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import typing
from dataclasses import dataclass
from pathlib import Path
from textwrap import dedent
from typing import (
Any,
Dict,
Expand Down Expand Up @@ -183,6 +184,17 @@ def snakemake_dag_to_interface(
RemoteFile(local_path=x, remote_path=remote_url)
)

# it is possible for two different input files to have the same parameter name
# as long as they are defined in different rules. This can lead to name collisions
# because we use a global mapping (across all rules) of param_name -> input_file.
if param in literals and literals[param].scalar.blob.uri != remote_url:
raise ValueError(dedent(f"""
Name collision detected for {job.name}. The following two input
parameters have the same name but different remote paths:
{param} -> {remote_url}
{param} -> {literals[param].scalar.blob.uri}
"""))

literals[param] = Literal(
scalar=Scalar(
blob=Blob(
Expand Down

0 comments on commit 947a877

Please sign in to comment.