Skip to content

Commit

Permalink
Merge pull request #386 from latchbio/rahuldesai1/snakemake/skip-fail…
Browse files Browse the repository at this point in the history
…ed-config-params

add warning when generic lists cannot be parsed
  • Loading branch information
ayushkamat authored Jan 29, 2024
2 parents 741fadf + 51ea65c commit 7786ed7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Types of changes

# Latch SDK Changelog

## 2.38.7 - 2023-01-26

### Fixed

* Snakemake
+ warn instead of error when config parameter type cannot be parsed in generate-metadata command

## 2.38.6 - 2023-01-26

### Added
Expand Down
9 changes: 8 additions & 1 deletion latch_cli/snakemake/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,14 @@ def parse_config(

parsed: Dict[str, Type] = {}
for k, v in res.items():
typ = parse_type(v, k, infer_files=infer_files)
try:
typ = parse_type(v, k, infer_files=infer_files)
except ValueError as e:
click.secho(
f"WARNING: Skipping parameter {k}. Failed to parse type: {e}.",
fg="yellow",
)
continue
val, default = parse_value(typ, v)

parsed[k] = (typ, (val, default))
Expand Down
7 changes: 4 additions & 3 deletions latch_cli/snakemake/config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ def parse_type(
)
for x in v
)
if len(set(parsed_types)) > 1:

if len(set(parsed_types)) != 1:
raise ValueError(
"Generic Lists are not supported - please ensure that all elements in a"
" list are of the same type",
"Generic Lists are not supported - please"
f" ensure that all elements in {name} are of the same type",
)
typ = parsed_types[0]
if typ in {LatchFile, LatchDir}:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

setup(
name="latch",
version="v2.38.6",
version="v2.38.7",
author_email="[email protected]",
description="The Latch SDK",
packages=find_packages(),
Expand Down

0 comments on commit 7786ed7

Please sign in to comment.