Class: Chronicle::ETL::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/chronicle/etl/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ Runner

Returns a new instance of Runner.



10
11
12
13
# File 'lib/chronicle/etl/runner.rb', line 10

def initialize(job)
  @job = job
  @job_logger = Chronicle::ETL::JobLogger.new(@job)
end

Instance Method Details

#run!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/chronicle/etl/runner.rb', line 15

def run!
  begin_job
  validate_job
  instantiate_connectors
  prepare_job
  prepare_ui
  run_extraction
rescue Chronicle::ETL::ExtractionError => e
  @job_logger&.error
  raise(Chronicle::ETL::RunnerError, "Extraction failed. #{e.message}")
rescue Interrupt
  @job_logger&.error
  raise(Chronicle::ETL::RunInterruptedError, 'Job interrupted.')
# rescue StandardError => e
#   # Just throwing this in here until we have better exception handling in
#   # loaders, etc
#   @job_logger&.error
#   raise(Chronicle::ETL::RunnerError, "Error running job. #{e.message}")
ensure
  finish_job
end