Skip to content

Commit

Permalink
Tests include their own job_conf.xml, fix bug when specifying job_con…
Browse files Browse the repository at this point in the history
…f.xml paths, code cleanup

The built-in dynamic_tool_destination tests now use a job_conf.xml
included alongside the testing tool destination yaml files. This
means that DTD can finally be tested in an automated fashion -- no
more manually putting a job_conf.xml into the config folder to make
things work.

This means that map_tool_to_destination now has an additional
parameter, job_conf_path -- the path to the job_config.xml file.

Also fixed is a bug that would add the Galaxy config folder path to
custom job_conf.xml paths.

Finally, the tests that were not relevant to the new version of DTD
that were commented out are now removed altogether.
  • Loading branch information
Matthew Spelchak committed Feb 7, 2018
1 parent ccf2144 commit acb0f15
Show file tree
Hide file tree
Showing 3 changed files with 564 additions and 106 deletions.
18 changes: 11 additions & 7 deletions lib/galaxy/jobs/dynamic_tool_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def __init__(self, *kwd):


def map_tool_to_destination(
job, app, tool, user_email, test=False, path=None):
job, app, tool, user_email, test=False, path=None, job_conf_path=None):
"""
Dynamically allocate resources
Expand All @@ -1219,12 +1219,14 @@ def map_tool_to_destination(
num_input_datasets_rule_present = False
records_rule_present = False

# Get configuration from tool_destinations.yml
# Get configuration from tool_destinations.yml and job_conf.xml
if path is None:
path = app.config.tool_destinations_config_file
if job_conf_path is None:
job_conf_path = app.config.job_config_file

try:
config = parse_yaml(path)
config = parse_yaml(path, job_conf_path)
except MalformedYMLException as e:
raise JobMappingException(e)

Expand Down Expand Up @@ -1498,11 +1500,13 @@ def get_destination_list_from_job_config(job_config_location='/config/job_conf.x

# os.path.realpath gets the path of DynamicToolDestination.py
# and then os.path.join is used to go back four directories
config_directory = os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../../..')

job_conf_file = config_directory + job_config_location
job_conf = ET.parse(job_conf_file)
if job_config_location == "/config/job_conf.xml":
config_location = os.path.join(
os.path.dirname(os.path.realpath(__file__)), '../../..')
job_config_location = config_location + job_config_location

job_conf = ET.parse(job_config_location)

for destination in job_conf.getroot().iter("destination"):
if isinstance(destination.get("id"), str):
Expand Down

0 comments on commit acb0f15

Please sign in to comment.