mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Set (copied) output hid before queuing job
Otherwise we may end up with a history item that either temporarily or permanently lacks a hid. This could currently be encountered via implicit conversion that set `visible=False` in the when calling `datatype.convert_dataset`.
This commit is contained in:
@@ -842,7 +842,11 @@ class Data(metaclass=DataMeta):
|
||||
# Make the target datatype available to the converter
|
||||
params["__target_datatype__"] = target_type
|
||||
# Run converter, job is dispatched through Queue
|
||||
job, converted_datasets, *_ = converter.execute(trans, incoming=params, set_output_hid=visible, history=history)
|
||||
job, converted_datasets, *_ = converter.execute(
|
||||
trans, incoming=params, set_output_hid=visible, history=history, flush_job=False
|
||||
)
|
||||
for converted_dataset in converted_datasets.values():
|
||||
original_dataset.attach_implicitly_converted_dataset(trans.sa_session, converted_dataset, target_type)
|
||||
trans.app.job_manager.enqueue(job, tool=converter)
|
||||
if len(params) > 0:
|
||||
trans.log_event(f"Converter params: {str(params)}", tool_id=converter.id)
|
||||
|
||||
@@ -11,7 +11,6 @@ from urllib.parse import quote_plus
|
||||
|
||||
from galaxy.datatypes.data import Data
|
||||
from galaxy.model import DatasetInstance
|
||||
from galaxy.model.base import transaction
|
||||
from galaxy.schema.schema import DatasetState
|
||||
from galaxy.util import string_as_bool
|
||||
from galaxy.util.template import fill_template
|
||||
@@ -182,22 +181,7 @@ class DisplayApplicationDataParameter(DisplayApplicationParameter):
|
||||
if target_ext and not converted_dataset:
|
||||
if isinstance(data, DisplayDataValueWrapper):
|
||||
data = data.value
|
||||
new_data = next(
|
||||
iter(
|
||||
data.datatype.convert_dataset(
|
||||
trans, data, target_ext, return_output=True, visible=False
|
||||
).values()
|
||||
)
|
||||
)
|
||||
new_data.hid = data.hid
|
||||
new_data.name = data.name
|
||||
trans.sa_session.add(new_data)
|
||||
assoc = trans.app.model.ImplicitlyConvertedDatasetAssociation(
|
||||
parent=data, file_type=target_ext, dataset=new_data, metadata_safe=False
|
||||
)
|
||||
trans.sa_session.add(assoc)
|
||||
with transaction(trans.sa_session):
|
||||
trans.sa_session.commit()
|
||||
data.datatype.convert_dataset(trans, data, target_ext, return_output=True, visible=False)
|
||||
elif converted_dataset and converted_dataset.state == DatasetState.ERROR:
|
||||
raise Exception(f"Dataset conversion failed for data parameter: {self.name}")
|
||||
return self.get_value(other_values, dataset_hash, user_hash, trans)
|
||||
|
||||
@@ -85,5 +85,7 @@ class DatasetProtocol(
|
||||
|
||||
def set_peek(self) -> None: ...
|
||||
|
||||
def attach_implicitly_converted_dataset(self, session, new_dataset, target_ext: str) -> None: ...
|
||||
|
||||
|
||||
class DatasetHasHidProtocol(DatasetProtocol, HasHid, Protocol): ...
|
||||
|
||||
@@ -4736,7 +4736,7 @@ class DatasetInstance(RepresentById, UsesCreateAndUpdateTime, _HasTable):
|
||||
raise NoConverterException(f"A dependency ({dependency}) is missing a converter.")
|
||||
except KeyError:
|
||||
pass # No deps
|
||||
new_dataset = next(
|
||||
return next(
|
||||
iter(
|
||||
self.datatype.convert_dataset(
|
||||
trans,
|
||||
@@ -4750,7 +4750,6 @@ class DatasetInstance(RepresentById, UsesCreateAndUpdateTime, _HasTable):
|
||||
).values()
|
||||
)
|
||||
)
|
||||
return self.attach_implicitly_converted_dataset(trans.sa_session, new_dataset, target_ext)
|
||||
|
||||
def attach_implicitly_converted_dataset(self, session, new_dataset, target_ext: str):
|
||||
new_dataset.name = self.name
|
||||
@@ -4760,9 +4759,6 @@ class DatasetInstance(RepresentById, UsesCreateAndUpdateTime, _HasTable):
|
||||
)
|
||||
session.add(new_dataset)
|
||||
session.add(assoc)
|
||||
with transaction(session):
|
||||
session.commit()
|
||||
return new_dataset
|
||||
|
||||
def copy_attributes(self, new_dataset):
|
||||
"""
|
||||
@@ -5134,7 +5130,8 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot
|
||||
self.tags.append(copied_tag)
|
||||
|
||||
def copy_attributes(self, new_dataset):
|
||||
new_dataset.hid = self.hid
|
||||
if new_dataset.hid is None:
|
||||
new_dataset.hid = self.hid
|
||||
|
||||
def to_library_dataset_dataset_association(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user