Skip to content

Commit

Permalink
Fix default priority assignment order
Browse files Browse the repository at this point in the history
Moved where default_priority is actually generated in the
map_tool_to_destination function. Now it calculates and assigns
default_priority to priority *before* the job/workflow parameter-
specified priority is assigned.
  • Loading branch information
Matthew Spelchak committed Feb 13, 2018
1 parent 6943470 commit cb28601
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lib/galaxy/jobs/dynamic_tool_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,24 @@ def map_tool_to_destination(
destination = "fail"
elif config is not None:

# Get the default priority from the config if necessary.
# If there isn't one, choose an arbitrary one as a fallback
if "default_destination" in config:
if isinstance(config['default_destination'], dict):
if 'default_priority' in config:
default_priority = config['default_priority']
priority = default_priority

else:
if len(priority_list) > 0:
default_priority = next(iter(priority_list))
priority = default_priority
error = ("No default priority found, arbitrarily setting '"
+ default_priority + "' as the default priority."
+ " Things may not work as expected!")
if verbose:
log.debug(error)

# fetch priority information from workflow/job parameters
job_parameter_list = job.get_parameters()
workflow_params = None
Expand All @@ -1365,25 +1383,7 @@ def map_tool_to_destination(
if 'priority' in resource_params:
if resource_params['priority'] is not None:
priority = resource_params['priority']

# Get the default priority from the config if necessary.
# If there isn't one, choose an arbitrary one as a fallback
if "default_destination" in config:
if isinstance(config['default_destination'], dict):
if 'default_priority' in config:
default_priority = config['default_priority']
priority = default_priority

else:
if len(priority_list) > 0:
default_priority = next(iter(priority_list))
priority = default_priority
error = ("No default priority found, arbitrarily setting '"
+ default_priority + "' as the default priority."
+ " Things may not work as expected!")
if verbose:
log.debug(error)


# get the user's priority
if "users" in config:
if user_email in config["users"]:
Expand Down

0 comments on commit cb28601

Please sign in to comment.