class Chronicle::ETL::Job
Attributes
extractor_klass[RW]
extractor_options[RW]
id[RW]
loader_klass[RW]
loader_options[RW]
name[RW]
transformer_klass[RW]
transformer_options[RW]
Public Class Methods
new(definition) { |self| ... }
click to toggle source
# File lib/chronicle/etl/job.rb, line 15 def initialize(definition) definition = definition.definition # FIXME @name = definition[:name] @extractor_klass = load_klass(:extractor, definition[:extractor][:name]) @extractor_options = definition[:extractor][:options] || {} @transformer_klass = load_klass(:transformer, definition[:transformer][:name]) @transformer_options = definition[:transformer][:options] || {} @loader_klass = load_klass(:loader, definition[:loader][:name]) @loader_options = definition[:loader][:options] || {} set_continuation if load_continuation? yield self if block_given? end
Public Instance Methods
instantiate_extractor()
click to toggle source
# File lib/chronicle/etl/job.rb, line 31 def instantiate_extractor instantiate_klass(:extractor) end
instantiate_loader()
click to toggle source
# File lib/chronicle/etl/job.rb, line 39 def instantiate_loader instantiate_klass(:loader) end
instantiate_transformer(data)
click to toggle source
# File lib/chronicle/etl/job.rb, line 35 def instantiate_transformer(data) instantiate_klass(:transformer, data) end
save_log?()
click to toggle source
# File lib/chronicle/etl/job.rb, line 43 def save_log? # TODO: this needs more nuance return !id.nil? end
Private Instance Methods
instantiate_klass(phase, *args)
click to toggle source
# File lib/chronicle/etl/job.rb, line 50 def instantiate_klass(phase, *args) options = self.send("#{phase.to_s}_options") args = args.unshift(options) klass = self.send("#{phase.to_s}_klass") klass.new(*args) end
load_continuation?()
click to toggle source
# File lib/chronicle/etl/job.rb, line 66 def load_continuation? save_log? end
load_klass(phase, identifier)
click to toggle source
# File lib/chronicle/etl/job.rb, line 57 def load_klass phase, identifier Chronicle::ETL::Catalog.phase_and_identifier_to_klass(phase, identifier) end
set_continuation()
click to toggle source
# File lib/chronicle/etl/job.rb, line 61 def set_continuation continuation = Chronicle::ETL::JobLogger.load_latest(@job_id) @extractor_options[:continuation] = continuation end