class Libis::Ingester::DB_CLASS
Public Class Methods
from_hash
Public Instance Methods
to_hash
Private Instance Methods
ancestors
clear_status()
click to toggle source
# File lib/libis/ingester/run.rb, line 153 def clear_status self.status_log.clear end
create_run_object
execute
ingest_dir
ingest_model()
click to toggle source
# File lib/libis/ingester/run.rb, line 45 def ingest_model self.job.ingest_model end
ingest_sub_dir()
click to toggle source
# File lib/libis/ingester/run.rb, line 67 def ingest_sub_dir self.id end
labelpath()
click to toggle source
# File lib/libis/ingester/run.rb, line 37 def labelpath; self.name; end
labels()
click to toggle source
# File lib/libis/ingester/run.rb, line 33 def labels Array.new end
material_flow
parent_of
producer
remove_items()
click to toggle source
# File lib/libis/ingester/run.rb, line 146 def remove_items self.get_items.each do |item| item.destroy! end self.items.clear end
remove_work_dir()
click to toggle source
# File lib/libis/ingester/run.rb, line 141 def remove_work_dir wd = self.work_dir FileUtils.rmtree wd if wd && !wd.blank? && Dir.exist?(wd) end
run(action = :run)
click to toggle source
Calls superclass method
# File lib/libis/ingester/run.rb, line 90 def run(action = :run) super(action) dir = File.dirname(self.log_filename) name = File.basename(self.log_filename, '.*') csv_file = File.join(dir, "#{name}.csv") html_file = File.join(dir, "#{name}.html") status('Run') != :DONE ? send_error_log(self.log_filename, csv_file, html_file) : send_success_log(self.log_filename, csv_file, html_file) end
send_error_log(log_file, csv_file, html_file)
click to toggle source
# File lib/libis/ingester/run.rb, line 103 def send_error_log(log_file, csv_file, html_file) return unless self.error_to log2csv(log_file, csv_file, skip_date: true, filter: 'WEF', trace: true) csv2html(csv_file, html_file) log2csv(log_file, csv_file, skip_date: false, trace: true) status_log = csv2html_io(status2csv_io(self)) send_email(csv_file, html_file) do |mail| mail.to = self.error_to mail.subject = "Ingest failed: #{self.name}" mail.html_part = [ "Unfortunately the ingest '#{self.name}' failed. Please find the ingest log in attachment.", "Status overview:", status_log.string ].join("\n") end FileUtils.remove csv_file, force: true FileUtils.remove html_file, force: true end
send_success_log(log_file, csv_file, html_file)
click to toggle source
# File lib/libis/ingester/run.rb, line 122 def send_success_log(log_file, csv_file, html_file) return unless self.success_to log2csv(log_file, csv_file, skip_date: true, filter: 'IWEF') csv2html(csv_file, html_file) log2csv(log_file, csv_file, skip_date: false, trace: true) status_log = csv2html_io(status2csv_io(self)) send_email(csv_file, html_file) do |mail| mail.to = self.success_to mail.subject = "Ingest complete: #{self.name}" mail.html_part = [ "The ingest '#{self.name}' finished successfully. Please find the ingest log in attachment.", "Status overview:", status_log.string ].join("\n") end FileUtils.remove csv_file, force: true FileUtils.remove html_file, force: true end
workflow()
click to toggle source
# File lib/libis/ingester/run.rb, line 41 def workflow self.job.workflow end