mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #3657 from lecorguille/dynamic_tool_nest_param
Allow nest param in the dynamic_tool rule -> argument
This commit is contained in:
@@ -121,7 +121,9 @@
|
||||
# destination: fail
|
||||
# fail_message: Don't do that
|
||||
# arguments:
|
||||
# careful: true
|
||||
# my_section:
|
||||
# my_condition:
|
||||
# careful: true
|
||||
# default_destination: cluster_low
|
||||
# default_destination: cluster
|
||||
# verbose: False
|
||||
|
||||
@@ -11,6 +11,7 @@ import sys
|
||||
import copy
|
||||
import collections
|
||||
import re
|
||||
from functools import reduce
|
||||
|
||||
|
||||
# log to galaxy's logger
|
||||
@@ -28,6 +29,17 @@ class ScannerError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def get_keys_from_dict(dl, keys_list):
|
||||
"""
|
||||
This function builds a list using the keys from nest dictionaries
|
||||
"""
|
||||
if isinstance(dl, dict):
|
||||
keys_list += dl.keys()
|
||||
map(lambda x: get_keys_from_dict(x, keys_list), dl.values())
|
||||
elif isinstance(dl, list):
|
||||
map(lambda x: get_keys_from_dict(x, keys_list), dl)
|
||||
|
||||
|
||||
class RuleValidator:
|
||||
"""
|
||||
This class is the primary facility for validating configs. It's always called
|
||||
@@ -1290,14 +1302,17 @@ def map_tool_to_destination(
|
||||
elif rule["rule_type"] == "arguments":
|
||||
options = job.get_param_values(app)
|
||||
matched = True
|
||||
|
||||
# check if the args in the config file are available
|
||||
for arg in rule["arguments"]:
|
||||
if arg in options:
|
||||
if rule["arguments"][arg] != options[arg]:
|
||||
arg_dict = {arg : rule["arguments"][arg]}
|
||||
arg_keys_list = []
|
||||
get_keys_from_dict(arg_dict, arg_keys_list)
|
||||
try:
|
||||
options_value = reduce(dict.__getitem__, arg_keys_list, options)
|
||||
arg_value = reduce(dict.__getitem__, arg_keys_list, arg_dict)
|
||||
if (arg_value != options_value):
|
||||
matched = False
|
||||
options = "test"
|
||||
else:
|
||||
except KeyError:
|
||||
matched = False
|
||||
if verbose:
|
||||
error = "Argument '" + str(arg)
|
||||
|
||||
Reference in New Issue
Block a user