Module: Ductr::JobETLRunner
Overview
Allowing a job to execute ETL runners. You need to declare the ETL_RUNNER_CLASS constant in the including class:
class CustomJobClass < Job
ETL_RUNNER_CLASS = ETL::KibaRunner
include JobETLRunner
end
The job must have the #parse_annotations method defined, which can be added by including ETL::Parser.
Instance Method Summary collapse
-
#initialize ⇒ Object
Parse job’s annotations and create the runner instance.
-
#run ⇒ void
Opens adapters, executes the runner and then closes back adapters.
Instance Method Details
#initialize ⇒ Object
Parse job’s annotations and create the runner instance.
19 20 21 22 23 |
# File 'lib/ductr/job_etl_runner.rb', line 19 def initialize(...) super(...) @runner = self.class::ETL_RUNNER_CLASS.new(*parse_annotations) end |
#run ⇒ void
This method returns an undefined value.
Opens adapters, executes the runner and then closes back adapters.
30 31 32 33 34 35 |
# File 'lib/ductr/job_etl_runner.rb', line 30 def run adapters.each(&:open!) @runner.run ensure adapters.each(&:close!) end |