Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue gracefully in set_meta if unable to count number of dataset lines. #7641

Merged
merged 2 commits into from Apr 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/galaxy/datatypes/data.py
Expand Up @@ -802,10 +802,16 @@ def count_data_lines(self, dataset):
"""
data_lines = 0
with compression_utils.get_fileobj(dataset.file_name) as in_file:
for line in in_file:
line = line.strip()
if line and not line.startswith('#'):
data_lines += 1
# FIXME: Potential encoding issue can prevent the ability to iterate over lines
# causing set_meta process to fail otherwise OK jobs. A better solution than
# a silent try/except is desirable.
try:
mvdbeek marked this conversation as resolved.
Show resolved Hide resolved
for line in in_file:
line = line.strip()
if line and not line.startswith('#'):
data_lines += 1
except Exception:
pass
return data_lines

def set_peek(self, dataset, line_count=None, is_multi_byte=False, WIDTH=256, skipchars=None, line_wrap=True):
Expand Down