Class: Coolhand::Vertex::BatchResultProcessor
- Inherits:
-
Object
- Object
- Coolhand::Vertex::BatchResultProcessor
- Defined in:
- lib/coolhand/vertex/batch_result_processor.rb
Instance Attribute Summary collapse
-
#batch_info ⇒ Object
readonly
Returns the value of attribute batch_info.
Instance Method Summary collapse
- #call(batch_results = []) ⇒ Object
-
#initialize(batch_info:) ⇒ BatchResultProcessor
constructor
A new instance of BatchResultProcessor.
Constructor Details
#initialize(batch_info:) ⇒ BatchResultProcessor
Returns a new instance of BatchResultProcessor.
8 9 10 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 8 def initialize(batch_info:) @batch_info = batch_info end |
Instance Attribute Details
#batch_info ⇒ Object (readonly)
Returns the value of attribute batch_info.
6 7 8 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 6 def batch_info @batch_info end |
Instance Method Details
#call(batch_results = []) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 12 def call(batch_results = []) Rails.logger.info("[Interceptor] BatchResultProcessor: #{batch_info}") case batch_info["state"] when "JOB_STATE_PENDING", "JOB_STATE_RUNNING", "JOB_STATE_QUEUED" Rails.logger.info("[Interceptor] Vertex batch #{batch_info} still processing") when "JOB_STATE_SUCCEEDED" batch_results.each { |batch_item| process_completed_batch(batch_item) } when "JOB_STATE_FAILED" handle_failed_batch else Rails.logger.warn("[Interceptor] Unknown batch status: #{batch_info['state']} for batch #{batch_info}") end rescue StandardError => e Rails.logger.error("[Interceptor] Failed to process Vertex batch results for #{batch_info}: #{e.}") end |