Class: Spotlight::Etl::Step
- Inherits:
-
Object
- Object
- Spotlight::Etl::Step
- Defined in:
- app/services/spotlight/etl/step.rb
Overview
ETL pipeline step
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
Instance Method Summary collapse
-
#call(*args) ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#finalize(*args) ⇒ Object
rubocop:enable Metrics/MethodLength.
-
#initialize(definition, label: nil, executor: nil) ⇒ Step
constructor
A new instance of Step.
Constructor Details
#initialize(definition, label: nil, executor: nil) ⇒ Step
Returns a new instance of Step.
12 13 14 15 16 |
# File 'app/services/spotlight/etl/step.rb', line 12 def initialize(definition, label: nil, executor: nil) @definition = definition @executor = executor @label = label end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
7 8 9 |
# File 'app/services/spotlight/etl/step.rb', line 7 def context @context end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
7 8 9 |
# File 'app/services/spotlight/etl/step.rb', line 7 def definition @definition end |
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
7 8 9 |
# File 'app/services/spotlight/etl/step.rb', line 7 def executor @executor end |
Instance Method Details
#call(*args) ⇒ Object
rubocop:disable Metrics/MethodLength
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/services/spotlight/etl/step.rb', line 19 def call(*args) with_logger do |logger| logger.debug { "Called with #{transform_data_for_debugging(args.first)}" } catch :skip do return action.call(*args).tap do |result| logger.debug { " => Returning #{transform_data_for_debugging(result)}" } if $VERBOSE end end logger.debug ' => Caught skip.' throw :skip end rescue StandardError => e with_logger do |logger| logger.error("Caught exception #{e}") end raise(e) end |
#finalize(*args) ⇒ Object
rubocop:enable Metrics/MethodLength
40 41 42 |
# File 'app/services/spotlight/etl/step.rb', line 40 def finalize(*args) action.finalize(*args) if action.respond_to? :finalize end |