Skip to content

Commit

Permalink
Add try catch when collectiong artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
janhybs committed Aug 15, 2018
1 parent ce0bea0 commit d9fd53a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
3 changes: 2 additions & 1 deletion ci-hpc/artifacts/collect/modules/flow123d_profiler_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import os
import re
from utils import strings

from artifacts.collect.modules import CollectResult, AbstractCollectModule, CIHPCReport

Expand Down Expand Up @@ -56,7 +57,7 @@ def process(self, object, from_file=None):
result=result,
timers=timers,
))

return CollectResult([report])

@classmethod
Expand Down
31 changes: 23 additions & 8 deletions ci-hpc/proc/step/step_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,18 @@ def process_step_collect(project, step, process_result, format_args=None):

for report, file in iter_reports(reports, conversion, is_file=False):
with logger:
collect_result = instance.process(report, file)
timers_total += len(collect_result.items)
timers_info.append((os.path.basename(file), len(collect_result.items)))
results.append(collect_result)
try:
collect_result = instance.process(report, file)
timers_total += len(collect_result.items)
timers_info.append((os.path.basename(file), len(collect_result.items)))
results.append(collect_result)
except Exception as e:
logger.warning(
'artifact processing failed (parse method) \n'
'module: %s\n'
'report: %s\n'
'file: %s\n', str(CollectModule), str(report), str(file))


with logger:
for file, timers in timers_info:
Expand All @@ -102,10 +110,17 @@ def process_step_collect(project, step, process_result, format_args=None):

for report, file in iter_reports(files, conversion, is_file=True):
with logger:
collect_result = instance.process(report, file)
timers_total += len(collect_result.items)
timers_info.append((os.path.basename(file), len(collect_result.items)))
results.append(collect_result)
try:
collect_result = instance.process(report, file)
timers_total += len(collect_result.items)
timers_info.append((os.path.basename(file), len(collect_result.items)))
results.append(collect_result)
except Exception as e:
logger.warning(
'artifact processing failed (files method) \n'
'module: %s\n'
'report: %s\n'
'file: %s\n', str(CollectModule), str(report), str(file))

with logger:
for file, timers in timers_info:
Expand Down

0 comments on commit d9fd53a

Please sign in to comment.