Class: Libis::Workflow::Tasks::Analyzer
- Inherits:
-
Libis::Workflow::Task
- Object
- Libis::Workflow::Task
- Libis::Workflow::Tasks::Analyzer
- Defined in:
- lib/libis/workflow/tasks/analyzer.rb
Instance Attribute Summary
Attributes inherited from Libis::Workflow::Task
Instance Method Summary collapse
Methods inherited from Libis::Workflow::Task
#<<, #apply_options, #initialize, #logger, #message, #namepath, #names, task_classes
Constructor Details
This class inherits a constructor from Libis::Workflow::Task
Instance Method Details
#run(item) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/libis/workflow/tasks/analyzer.rb', line 15 def run(item) item.properties[:ingest_failed] = item.check_status(:FAILED) item.summary = {} item.log_history.each do |log| level = log[:severity] item.summary[level.to_s] ||= 0 item.summary[level.to_s] += 1 end item.each do |i| run i i.summary.each do |level, count| item.summary[level] ||= 0 item.summary[level] += (count || 0) end end rescue RuntimeError => ex puts 'Failed to analyze item: %s - %s' % [item.class, item.name] puts 'Exception: %s' % ex. ensure item.save end |