Do not re-compute job input_ext/dbkey (if unneeded).

Remote metadata computation needs input_ext in the job parameters (like dbkey) so no need to re-loop through the inp_data to recompute it.

Additionally the loop here in discover_outputs in the job or job handler might be running on a different Python version or different Galaxy version than the tool action in the web controller - and this is a dict not a list. Therefore the loop might result in a different value for input_ext. For this reason, it is better to just compute it once and reuse it anyway for a greater guarantee of consistency.
This commit is contained in:
John Chilton
2019-10-30 13:39:21 -04:00
parent de36ef10d6
commit 8aa24fa968
3 changed files with 23 additions and 9 deletions
+19 -8
View File
@@ -1695,14 +1695,25 @@ class JobWrapper(HasResourceParameters):
self.cleanup(delete_files=delete_files)
def discover_outputs(self, job, inp_data, out_data, out_collections):
input_ext = 'data'
input_dbkey = '?'
for _, data in inp_data.items():
# For loop odd, but sort simulating behavior in galaxy.tools.actions
if not data:
continue
input_ext = data.ext
input_dbkey = data.dbkey or '?'
# Try to just recover input_ext and dbkey from job parameters (used and set in
# galaxy.tools.actions). Old jobs may have not set these in the job parameters
# before persisting them.
input_params = job.raw_param_dict()
input_ext = input_params.get("__input_ext")
input_dbkey = input_params.get("dbkey")
if input_ext is not None:
input_ext = loads(input_ext)
input_dbkey = loads(input_dbkey)
else:
# Legacy jobs without __input_ext.
input_ext = 'data'
input_dbkey = '?'
for _, data in inp_data.items():
# For loop odd, but sort simulating behavior in galaxy.tools.actions
if not data:
continue
input_ext = data.ext
input_dbkey = data.dbkey or '?'
# Create generated output children and primary datasets.
tool_working_directory = self.tool_working_directory
+3 -1
View File
@@ -283,7 +283,9 @@ class JobSearch(object):
# parameter as these are not passed along when expanding tool parameters
# and they can differ without affecting the resulting dataset.
for parameter in job.parameters:
if parameter.name in {'__workflow_invocation_uuid__', 'chromInfo', 'dbkey'} or parameter.name.endswith('|__identifier__'):
if parameter.name.startswith("__"):
continue
if parameter.name in {'chromInfo', 'dbkey'} or parameter.name.endswith('|__identifier__'):
continue
n_parameters += 1
if not n_parameters == len(param_dump):
+1
View File
@@ -334,6 +334,7 @@ class DefaultToolAction(object):
# Add the dbkey to the incoming parameters
incoming["dbkey"] = input_dbkey
incoming["__input_ext"] = input_ext
# wrapped params are used by change_format action and by output.label; only perform this wrapping once, as needed
wrapped_params = self._wrapped_params(trans, tool, incoming, inp_data)