Merge branch 'release_21.09' into dev

This commit is contained in:
mvdbeek
2021-10-22 22:21:17 +02:00
19 changed files with 34 additions and 50 deletions
@@ -35,7 +35,7 @@
<p>
<b
><a class="export-link" href="#" @click.prevent="regenerateExport"
>Click here to to generate a new archive for this history.</a
>Click here to generate a new archive for this history.</a
></b
>
</p>
+1 -2
View File
@@ -128,8 +128,7 @@ class LibraryActions:
job_params['link_data_only'] = json.dumps(kwd.get('link_data_only', 'copy_files'))
job_params['uuid'] = json.dumps(kwd.get('uuid', None))
job, output = upload_common.create_job(trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder, job_params=job_params)
trans.sa_session.add(job)
trans.sa_session.flush()
trans.app.job_manager.enqueue(job, tool=tool)
return output
def _get_server_dir_uploaded_datasets(self, trans, params, full_dir, import_dir_desc, library_bunch, response_code, message):
+4 -3
View File
@@ -650,14 +650,15 @@ class Data(metaclass=DataMeta):
# Make the target datatype available to the converter
params['__target_datatype__'] = target_type
# Run converter, job is dispatched through Queue
converted_dataset = converter.execute(trans, incoming=params, set_output_hid=visible, history=history)[1]
job, converted_datasets, *_ = converter.execute(trans, incoming=params, set_output_hid=visible, history=history)
trans.app.job_manager.enqueue(job, tool=converter)
if len(params) > 0:
trans.log_event(f"Converter params: {str(params)}", tool_id=converter.id)
if not visible:
for value in converted_dataset.values():
for value in converted_datasets.values():
value.visible = False
if return_output:
return converted_dataset
return converted_datasets
return f"The file conversion of {converter.name} on data {original_dataset.hid} has been added to the Queue."
# We need to clear associated files before we set metadata
+4 -2
View File
@@ -374,9 +374,10 @@ class DatasetAssociationManager(base.ModelManager,
if spec.get('default'):
setattr(data.metadata, name, spec.unwrap(spec.get('default')))
self.app.datatypes_registry.set_external_metadata_tool.tool_action.execute(
job, *_ = self.app.datatypes_registry.set_external_metadata_tool.tool_action.execute(
self.app.datatypes_registry.set_external_metadata_tool, trans, incoming={'input1': data, 'validate': validate},
overwrite=overwrite)
self.app.job_manager.enqueue(job, tool=self.app.datatypes_registry.set_external_metadata_tool)
def update_permissions(self, trans, dataset_assoc, **kwd):
action = kwd.get('action', 'set_permissions')
@@ -691,7 +692,8 @@ class DatasetAssociationDeserializer(base.ModelDeserializer, deletable.PurgableD
sa_session = self.app.model.context
sa_session.flush()
trans = context.get("trans")
self.app.datatypes_registry.set_external_metadata_tool.tool_action.execute(self.app.datatypes_registry.set_external_metadata_tool, trans, incoming={'input1': item}, overwrite=False) # overwrite is False as per existing behavior
job, *_ = self.app.datatypes_registry.set_external_metadata_tool.tool_action.execute(self.app.datatypes_registry.set_external_metadata_tool, trans, incoming={'input1': item}, overwrite=False) # overwrite is False as per existing behavior
trans.app.job_manager.enqueue(job, tool=trans.app.datatypes_registry.set_external_metadata_tool)
return item.datatype
+4 -2
View File
@@ -186,7 +186,8 @@ class HistoryManager(sharable.SharableModelManager, deletable.PurgableManagerMix
# Run job to do import.
history_imp_tool = trans.app.toolbox.get_tool('__IMPORT_HISTORY__')
incoming = {'__ARCHIVE_SOURCE__': archive_source, '__ARCHIVE_TYPE__': archive_type}
job, _ = history_imp_tool.execute(trans, incoming=incoming)
job, *_ = history_imp_tool.execute(trans, incoming=incoming)
trans.app.job_manager.enqueue(job, tool=history_imp_tool)
return job
# TODO: remove this function when the legacy endpoint using it is removed
@@ -234,7 +235,8 @@ class HistoryManager(sharable.SharableModelManager, deletable.PurgableManagerMix
# Run job to do export.
history_exp_tool = trans.app.toolbox.get_tool(export_tool_id)
job, _ = history_exp_tool.execute(trans, incoming=params, history=history, set_output_hid=True)
job, *_ = history_exp_tool.execute(trans, incoming=params, history=history, set_output_hid=True)
trans.app.job_manager.enqueue(job, tool=history_exp_tool)
return job
def get_sharing_extra_information(
+1 -1
View File
@@ -5520,7 +5520,7 @@ Examples are included in the test tools directory including:
<xs:extension base="xs:string">
<xs:attribute name="interpreter" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[*Deprecated*. This will prefix the version command with the value of this attribute (e.g. ``python`` or ``perl``) and the tool directory, in order to to run an executable file shipped with the tool. It is recommended to instead use ``<interpreter> '$__tool_directory__/<executable_name>'`` in the tag content. If this attribute is not specified, the tag should contain a Bash command calling executable(s) available in the ``$PATH``, as modified after loading the requirements.]]></xs:documentation>
<xs:documentation xml:lang="en"><![CDATA[*Deprecated*. This will prefix the version command with the value of this attribute (e.g. ``python`` or ``perl``) and the tool directory, in order to run an executable file shipped with the tool. It is recommended to instead use ``<interpreter> '$__tool_directory__/<executable_name>'`` in the tag content. If this attribute is not specified, the tag should contain a Bash command calling executable(s) available in the ``$PATH``, as modified after loading the requirements.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
+2 -1
View File
@@ -2694,10 +2694,11 @@ class SetMetadataTool(Tool):
def regenerate_imported_metadata_if_needed(self, hda, history, job):
if len(hda.metadata_file_types) > 0:
self.tool_action.execute_via_app(
job, *_ = self.tool_action.execute_via_app(
self, self.app, job.session_id,
history.id, job.user, incoming={'input1': hda}, overwrite=False
)
self.app.job_manager.enqueue(job=job, tool=self)
def exec_after_process(self, app, inp_data, out_data, param_dict, job=None, **kwds):
working_directory = app.object_store.get_filename(
-3
View File
@@ -603,9 +603,6 @@ class DefaultToolAction:
trans.sa_session.flush()
log.info(f"Flushed transaction for job {job.log_str()} {job_flush_timer}")
# Dispatch to a job handler. enqueue() is responsible for flushing the job
app.job_manager.enqueue(job, tool=tool)
trans.log_event(f"Added job to the job queue, id: {str(job.id)}", tool_id=job.tool_id)
return job, out_data, history
def _remap_job_on_rerun(self, trans, galaxy_session, rerun_remap_job_id, current_job, out_data):
@@ -67,11 +67,6 @@ class ImportHistoryToolAction(ToolAction):
job.add_parameter(name, value)
job.state = start_job_state # job inputs have been configured, restore initial job state
# Queue the job for execution
trans.app.job_manager.enqueue(job, tool=tool)
trans.log_event(f"Added import history job to the job queue, id: {str(job.id)}", tool_id=job.tool_id)
return job, {}
-5
View File
@@ -120,11 +120,6 @@ class SetMetadataToolAction(ToolAction):
job.state = start_job_state # job inputs have been configured, restore initial job state
sa_session.flush()
# Queue the job for execution
app.job_manager.enqueue(job, tool=tool)
# FIXME: need to add event logging to app and log events there rather than trans.
# trans.log_event( "Added set external metadata job to the job queue, id: %s" % str(job.id), tool_id=job.tool_id )
# clear e.g. converted files
dataset.datatype.before_setting_metadata(dataset)
+1 -13
View File
@@ -395,6 +395,7 @@ def create_job(trans, params, tool, json_file_path, outputs, folder=None, histor
Create the upload job.
"""
job = trans.app.model.Job()
trans.sa_session.add(job)
job.galaxy_version = trans.app.config.version_major
galaxy_session = trans.get_galaxy_session()
if type(galaxy_session) == trans.model.GalaxySession:
@@ -410,16 +411,10 @@ def create_job(trans, params, tool, json_file_path, outputs, folder=None, histor
job.tool_id = tool.id
job.tool_version = tool.version
job.dynamic_tool = tool.dynamic_tool
job.set_state(job.states.UPLOAD)
trans.sa_session.add(job)
trans.sa_session.flush()
log.info('tool %s created job id %d' % (tool.id, job.id))
trans.log_event('created job id %d' % job.id, tool_id=tool.id)
for name, value in tool.params_to_strings(params, trans.app).items():
job.add_parameter(name, value)
job.add_parameter('paramfile', dumps(json_file_path))
object_store_id = None
for i, output_object in enumerate(outputs):
output_name = "output%i" % i
if hasattr(output_object, "collection"):
@@ -432,18 +427,11 @@ def create_job(trans, params, tool, json_file_path, outputs, folder=None, histor
else:
job.add_output_dataset(output_name, dataset)
trans.sa_session.add(output_object)
job.object_store_id = object_store_id
job.set_state(job.states.NEW)
if job_params:
for name, value in job_params.items():
job.add_parameter(name, value)
trans.sa_session.add(job)
# Queue the job for execution
trans.app.job_manager.enqueue(job, tool=tool)
trans.log_event(f"Added job to the job queue, id: {str(job.id)}", tool_id=job.tool_id)
output = {}
for i, v in enumerate(outputs):
if not hasattr(output_object, "collection_type"):
+4 -1
View File
@@ -2419,7 +2419,10 @@ class DirectoryUriToolParameter(SimpleTextToolParameter):
super().validate(value, trans=trans)
if not value:
return # value is not set yet, do not validate
file_source = trans.app.file_sources.get_file_source_path(value).file_source
file_source_path = trans.app.file_sources.get_file_source_path(value)
file_source = file_source_path.file_source
if file_source is None:
raise ParameterValueError(f"'{value}' is not a valid file source uri.", self.name)
user_context = ProvidesUserFileSourcesUserContext(trans)
user_has_access = file_source.user_has_access(user_context)
if not user_has_access:
+2 -2
View File
@@ -76,9 +76,9 @@ class GridColumn:
"""Sort query using this column."""
if column_name is None:
column_name = self.key
column = self.model_class.table.c.get(column_name)
column = getattr(self.model_class, column_name)
if column is None:
column = getattr(self.model_class, column_name)
column = self.model_class.table.c.get(column_name)
if ascending:
query = query.order_by(column.asc())
else:
+2 -2
View File
@@ -456,8 +456,8 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, context.ProvidesHistoryCo
# We'll end up creating a new galaxy_session
session_key = None
# If remote user is in use it can invalidate the session and in some
# cases won't have a cookie set above, so we need to to check some
# things now.
# cases won't have a cookie set above, so we need to check some things
# now.
if self.app.config.use_remote_user:
remote_user_email = self.environ.get(self.app.config.remote_user_header, None)
if galaxy_session:
@@ -520,8 +520,7 @@ class LibraryDatasetsController(BaseGalaxyAPIController, UsesVisualizationMixin,
job_params['link_data_only'] = dumps(kwd.get('link_data_only', 'copy_files'))
job_params['uuid'] = dumps(kwd.get('uuid', None))
job, output = upload_common.create_job(trans, tool_params, tool, json_file_path, data_list, folder=folder, job_params=job_params)
trans.sa_session.add(job)
trans.sa_session.flush()
trans.app.job_manager.enqueue(job, tool=tool)
job_dict = job.to_dict()
job_dict['id'] = trans.security.encode_id(job_dict['id'])
return job_dict
@@ -89,7 +89,8 @@ class ASync(BaseUIController):
raise Exception("Error: ToolOutput object not found")
original_history = trans.sa_session.query(trans.app.model.History).get(data.history_id)
tool.execute(trans, incoming=params, history=original_history)
job, *_ = tool.execute(trans, incoming=params, history=original_history)
trans.app.job_manager.enqueue(job, tool=tool)
else:
log.debug(f'async error -> {STATUS}')
trans.log_event(f'Async error -> {STATUS}')
@@ -378,9 +378,10 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
datatype = sniff.guess_ext(path, trans.app.datatypes_registry.sniff_order, is_binary=is_binary)
trans.app.datatypes_registry.change_datatype(data, datatype)
trans.sa_session.flush()
trans.app.datatypes_registry.set_external_metadata_tool.tool_action.execute(
job, *_ = trans.app.datatypes_registry.set_external_metadata_tool.tool_action.execute(
trans.app.datatypes_registry.set_external_metadata_tool, trans, incoming={'input1': data},
overwrite=False) # overwrite is False as per existing behavior
trans.app.job_manager.enqueue(job, tool=trans.app.datatypes_registry.set_external_metadata_tool)
message = f'Detection was finished and changed the datatype to {datatype}.'
else:
return self.message_exception(trans, f'Changing datatype "{data.extension}" is not allowed.')
+2 -2
View File
@@ -953,10 +953,10 @@ class InputParameterModule(WorkflowModule):
if restrictions_list is None:
restrictions_list = []
restriction_values = self._parameter_option_def_to_tool_form_str(restrictions_list)
restrictions_source = dict(name="restrictions", label="Restriction Values", value=restriction_values, help="Comman-separated list of potential all values")
restrictions_source = dict(name="restrictions", label="Restricted Values", value=restriction_values, help="Comma-separated list of all permitted values")
restrictions = TextToolParameter(None, restrictions_source)
suggestions_source = dict(name="suggestions", label="Suggestion Values", value=restriction_values, help="Comman-separated list of some potential values")
suggestions_source = dict(name="suggestions", label="Suggested Values", value=restriction_values, help="Comma-separated list of some potential values")
suggestions = TextToolParameter(None, suggestions_source)
when_restrict_static_restrictions.inputs["restrictions"] = restrictions
+1 -1
View File
@@ -298,7 +298,7 @@ function perform_stable_merge() {
log_exec git merge -m "Merge branch 'release_${RELEASE_CURR}' into '${STABLE_BRANCH}'" "__release_${RELEASE_CURR}"
PUSH_BRANCHES+=("__stable:${STABLE_BRANCH}")
else
log "Release '${RELEASE_CURR}' < stable branch release '${stable}', skipping merge to to '${STABLE_BRANCH}'"
log "Release '${RELEASE_CURR}' < stable branch release '${stable}', skipping merge to '${STABLE_BRANCH}'"
fi
git checkout "$branch_curr"
}