mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'release_15.03' into dev
This commit is contained in:
@@ -34,10 +34,10 @@ from galaxy.tools.actions.upload import UploadToolAction
|
||||
from galaxy.tools.actions.data_source import DataSourceToolAction
|
||||
from galaxy.tools.actions.data_manager import DataManagerToolAction
|
||||
from galaxy.tools.deps import build_dependency_manager
|
||||
from galaxy.tools.parameters import params_to_incoming, check_param, params_from_strings, params_to_strings
|
||||
from galaxy.tools.parameters import params_to_incoming, check_param, params_from_strings, params_to_strings, visit_input_values
|
||||
from galaxy.tools.parameters import output_collect
|
||||
from galaxy.tools.parameters.basic import (BaseURLToolParameter,
|
||||
DataToolParameter, HiddenToolParameter, LibraryDatasetToolParameter,
|
||||
DataToolParameter, DataCollectionToolParameter, HiddenToolParameter, LibraryDatasetToolParameter,
|
||||
SelectToolParameter, ToolParameter, UnvalidatedValue,
|
||||
IntegerToolParameter, FloatToolParameter)
|
||||
from galaxy.tools.parameters.grouping import Conditional, ConditionalWhen, Repeat, UploadDataset
|
||||
@@ -52,7 +52,7 @@ from galaxy.util import rst_to_html, string_as_bool, string_to_object
|
||||
from galaxy.tools.parameters.meta import expand_meta_parameters
|
||||
from galaxy.util.bunch import Bunch
|
||||
from galaxy.util.expressions import ExpressionContext
|
||||
from galaxy.util.hash_util import hmac_new
|
||||
from galaxy.util.hash_util import hmac_new, is_hashable
|
||||
from galaxy.util.odict import odict
|
||||
from galaxy.util.template import fill_template
|
||||
from galaxy.web import url_for
|
||||
@@ -2291,6 +2291,7 @@ class Tool( object, Dictifiable ):
|
||||
try:
|
||||
job_params = job.get_param_values( trans.app, ignore_errors = True )
|
||||
job_messages = self.check_and_update_param_values( job_params, trans, update_values=False )
|
||||
self._map_source_to_history( trans, self.inputs, job_params )
|
||||
tool_message = self._compare_tool_version(trans, job)
|
||||
params_to_incoming( kwd, self.inputs, job_params, trans.app, to_html=False )
|
||||
except Exception, exception:
|
||||
@@ -2564,6 +2565,59 @@ class Tool( object, Dictifiable ):
|
||||
# return enriched tool model
|
||||
return tool_model
|
||||
|
||||
def _map_source_to_history(self, trans, tool_inputs, params):
|
||||
# Need to remap dataset parameters. Job parameters point to original
|
||||
# dataset used; parameter should be the analygous dataset in the
|
||||
# current history.
|
||||
history = trans.get_history()
|
||||
hda_source_dict = {} # Mapping from HDA in history to source HDAs.
|
||||
for hda in history.datasets:
|
||||
source_hda = hda.copied_from_history_dataset_association
|
||||
while source_hda:#should this check library datasets as well?
|
||||
#FIXME: could be multiple copies of a hda in a single history, this does a better job of matching on cloned histories,
|
||||
#but is still less than perfect when eg individual datasets are copied between histories
|
||||
if source_hda not in hda_source_dict or source_hda.hid == hda.hid:
|
||||
hda_source_dict[ source_hda ] = hda
|
||||
source_hda = source_hda.copied_from_history_dataset_association
|
||||
|
||||
# Ditto for dataset collections.
|
||||
hdca_source_dict = {}
|
||||
for hdca in history.dataset_collections:
|
||||
source_hdca = hdca.copied_from_history_dataset_collection_association
|
||||
while source_hdca:
|
||||
if source_hdca not in hdca_source_dict or source_hdca.hid == hdca.hid:
|
||||
hdca_source_dict[ source_hdca ] = hdca
|
||||
source_hdca = source_hdca.copied_from_history_dataset_collection_association
|
||||
|
||||
# Unpack unvalidated values to strings, they'll be validated when the
|
||||
# form is submitted (this happens when re-running a job that was
|
||||
# initially run by a workflow)
|
||||
#This needs to be done recursively through grouping parameters
|
||||
def rerun_callback( input, value, prefixed_name, prefixed_label ):
|
||||
if isinstance( value, UnvalidatedValue ):
|
||||
try:
|
||||
return input.to_html_value( value.value, trans.app )
|
||||
except Exception, e:
|
||||
# Need to determine when (if ever) the to_html_value call could fail.
|
||||
log.debug( "Failed to use input.to_html_value to determine value of unvalidated parameter, defaulting to string: %s" % ( e ) )
|
||||
return str( value )
|
||||
if isinstance( input, DataToolParameter ):
|
||||
if isinstance(value,list):
|
||||
values = []
|
||||
for val in value:
|
||||
if is_hashable( val ):
|
||||
if val in history.datasets:
|
||||
values.append( val )
|
||||
elif val in hda_source_dict:
|
||||
values.append( hda_source_dict[ val ])
|
||||
return values
|
||||
if is_hashable( value ) and value not in history.datasets and value in hda_source_dict:
|
||||
return hda_source_dict[ value ]
|
||||
elif isinstance( input, DataCollectionToolParameter ):
|
||||
if is_hashable( value ) and value not in history.dataset_collections and value in hdca_source_dict:
|
||||
return hdca_source_dict[ value ]
|
||||
visit_input_values( tool_inputs, params, rerun_callback )
|
||||
|
||||
def _compare_tool_version( self, trans, job ):
|
||||
"""
|
||||
Compares a tool version with the tool version from a job (from ToolRunner).
|
||||
|
||||
@@ -3,7 +3,7 @@ API operations allowing clients to determine Galaxy instance's capabilities
|
||||
and configuration settings.
|
||||
"""
|
||||
|
||||
from galaxy.web import _future_expose_api_anonymous as expose_api_anonymous
|
||||
from galaxy.web import _future_expose_api_anonymous_and_sessionless as expose_api_anonymous_and_sessionless
|
||||
from galaxy.web import _future_expose_api as expose_api
|
||||
from galaxy.web import require_admin
|
||||
from galaxy.web.base.controller import BaseAPIController
|
||||
@@ -21,7 +21,7 @@ class ConfigurationController( BaseAPIController ):
|
||||
self.config_serializer = ConfigSerializer( app )
|
||||
self.admin_config_serializer = AdminConfigSerializer( app )
|
||||
|
||||
@expose_api_anonymous
|
||||
@expose_api_anonymous_and_sessionless
|
||||
def index( self, trans, **kwd ):
|
||||
"""
|
||||
GET /api/configuration
|
||||
@@ -33,7 +33,7 @@ class ConfigurationController( BaseAPIController ):
|
||||
serialization_params = self._parse_serialization_params( kwd, 'all' )
|
||||
return self.get_config_dict( trans, is_admin, **serialization_params )
|
||||
|
||||
@expose_api_anonymous
|
||||
@expose_api_anonymous_and_sessionless
|
||||
def version( self, trans, **kwds ):
|
||||
"""
|
||||
GET /api/version
|
||||
|
||||
Reference in New Issue
Block a user