Skip to content

Commit

Permalink
Adhere to Galaxy Python standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Spelchak committed Feb 13, 2018
1 parent a5e8d82 commit 125d126
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions lib/galaxy/jobs/dynamic_tool_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ def map_tool_to_destination(
workflow_params = param.value
if param.name == "__job_resource":
job_params = param.value

# Priority coming from workflow invocation takes precedence over job specific priorities
if workflow_params is not None:
resource_params = json.loads(workflow_params)
Expand All @@ -1378,13 +1378,13 @@ def map_tool_to_destination(
# request was created.
if resource_params['priority'] is not None:
priority = resource_params['priority']

elif job_params is not None:
resource_params = json.loads(job_params)
if 'priority' in resource_params:
if resource_params['priority'] is not None:
priority = resource_params['priority']

# get the user's priority
if "users" in config:
if user_email in config["users"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def test_tool_default_destination_without_priority_not_in_job_conf(self, l):
)

@log_capture()
def test_tool_default_destination_without_priority_not_in_job_conf(self, l):
def test_empty_priority_dict(self, l):
dt.parse_yaml(path=yt.ivYMLTest163, job_conf_path=job_conf_path, test=True)
l.check(
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Running config validation...'),
Expand Down Expand Up @@ -813,7 +813,7 @@ def test_parse_valid_yml(self, l):
self.assertEqual(dt.parse_yaml(yt.vYMLTest160, job_conf_path=job_conf_path, test=True), yt.vdictTest160_yml)
self.assertTrue(dt.parse_yaml(yt.vYMLTest164, job_conf_path=job_conf_path, test=True, return_bool=True))
self.assertEqual(dt.parse_yaml(yt.vYMLTest164, job_conf_path=job_conf_path, test=True), yt.vdictTest164_yml)

l.check(
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Running config validation...'),
('galaxy.jobs.dynamic_tool_destination', 'DEBUG', 'Finished config validation.'),
Expand Down
82 changes: 41 additions & 41 deletions test/unit/jobs/dynamic_tool_destination/ymltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
'med': 'waffles_default'
}
},
'default_priority': 'med',
'default_priority': 'med',
'users': {
'user@example.com': {
'priority': 'med'
Expand All @@ -297,21 +297,21 @@
'''

vdictTest160_yml = {
"tools": {
"blah": {
"rules": [
{
"rule_type": "num_input_datasets",
"nice_value": 0,
"lower_bound": 0,
"upper_bound": "Infinity",
"destination": "waffles_default"
}
],
"default_destination": "waffles_high"
}
},
'default_destination': 'waffles_low',
"tools": {
"blah": {
"rules": [
{
"rule_type": "num_input_datasets",
"nice_value": 0,
"lower_bound": 0,
"upper_bound": "Infinity",
"destination": "waffles_default"
}
],
"default_destination": "waffles_high"
}
},
'default_destination': 'waffles_low',
}

# No valid priorities but the tool doesn't require one
Expand Down Expand Up @@ -339,36 +339,36 @@
'''

vdictTest164_yml = {
"tools": {
"blah": {
"rules": [
{
"rule_type": "num_input_datasets",
"nice_value": 0,
"lower_bound": 0,
"upper_bound": "Infinity",
"destination": {
"priority": {
"fast": "lame_cluster"
}
"tools": {
"blah": {
"rules": [
{
"rule_type": "num_input_datasets",
"nice_value": 0,
"lower_bound": 0,
"upper_bound": "Infinity",
"destination": {
"priority": {
"fast": "lame_cluster"
}
}
}
}
],
"default_destination": {
"priority": {
"good": "cluster_med_4",
"fast": "waffles_high"
}
],
"default_destination": {
"priority": {
"good": "cluster_med_4",
"fast": "waffles_high"
}
}
}
}
},
'default_destination': {
"priority": {
"good": "Destination1_med",
"fast": "Destination1_high"
}
"priority": {
"good": "Destination1_med",
"fast": "Destination1_high"
}
},
'default_priority': 'good'
'default_priority': 'good'
}

# =====================================================Invalid XML tests==========================================================
Expand Down

0 comments on commit 125d126

Please sign in to comment.