Skip to content

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

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/galaxy/datatypes/data.py
Original file line number Diff line number Diff line change
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:
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