mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Respect unavilable peek when serializing HDA
Also call display_peek() just once.
That fixes the following exception that occurs when running the Filter1
tool through the API:
```
galaxy.datatypes.tabular ERROR 2018-08-12 22:53:42,939 make_html_peek_rows failed on HDA 64
Traceback (most recent call last):
File "/Users/mvandenb/src/galaxy/lib/galaxy/datatypes/tabular.py", line 186, in make_html_peek_rows
dataset.set_peek()
File "/Users/mvandenb/src/galaxy/lib/galaxy/model/__init__.py", line 2264, in set_peek
return self.datatype.set_peek(self)
File "/Users/mvandenb/src/galaxy/lib/galaxy/datatypes/tabular.py", line 57, in set_peek
super(TabularData, self).set_peek(dataset, line_count=line_count, WIDTH=WIDTH, skipchars=skipchars, line_wrap=False)
File "/Users/mvandenb/src/galaxy/lib/galaxy/datatypes/data.py", line 813, in set_peek
dataset.peek = get_file_peek(dataset.file_name, WIDTH=WIDTH, skipchars=skipchars, line_wrap=line_wrap)
File "/Users/mvandenb/src/galaxy/lib/galaxy/datatypes/data.py", line 1029, in get_file_peek
with compression_utils.get_fileobj(file_name, "U") as temp:
File "/Users/mvandenb/src/galaxy/lib/galaxy/util/compression_utils.py", line 29, in get_fileobj
return get_fileobj_raw(filename, mode, compressed_formats)[1]
File "/Users/mvandenb/src/galaxy/lib/galaxy/util/compression_utils.py", line 58, in get_fileobj_raw
return compressed_format, io.open(filename, mode, encoding='utf-8')
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/df/6xqpqpcd7h73b6jpx9t6cwhw0000gn/T/tmpan_4qaow/tmpfzus9jhv/tmplqjtbp5c/database/files/000/dataset_40.dat'
```
This is because we serialize the HDA just after the job has been
created, meaning the file may not exist yet.
This commit is contained in:
@@ -54,7 +54,6 @@ from galaxy.util.sanitize_html import sanitize_html
|
||||
from galaxy.web.form_builder import (AddressField, CheckboxField, HistoryField,
|
||||
PasswordField, SelectField, TextArea, TextField, WorkflowField,
|
||||
WorkflowMappingField)
|
||||
from galaxy.web.framework.helpers import to_unicode
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -2753,7 +2752,7 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot
|
||||
uuid=(lambda uuid: str(uuid) if uuid else None)(hda.dataset.uuid),
|
||||
hid=hda.hid,
|
||||
file_ext=hda.ext,
|
||||
peek=(lambda hda: hda.display_peek() if hda.peek and hda.peek != 'no peek' else None)(hda),
|
||||
peek=unicodify(hda.display_peek()) if hda.peek and hda.peek != 'no peek' else None,
|
||||
model_class=self.__class__.__name__,
|
||||
name=hda.name,
|
||||
deleted=hda.deleted,
|
||||
@@ -2780,8 +2779,6 @@ class HistoryDatasetAssociation(DatasetInstance, HasTags, Dictifiable, UsesAnnot
|
||||
if hda.extended_metadata is not None:
|
||||
rval['extended_metadata'] = hda.extended_metadata.data
|
||||
|
||||
rval['peek'] = to_unicode(hda.display_peek())
|
||||
|
||||
for name, spec in hda.metadata.spec.items():
|
||||
val = hda.metadata.get(name)
|
||||
if isinstance(val, MetadataFile):
|
||||
|
||||
Reference in New Issue
Block a user