Class: Coolhand::Vertex::BatchResultProcessor
- Inherits:
-
Object
- Object
- Coolhand::Vertex::BatchResultProcessor
- Defined in:
- lib/coolhand/vertex/batch_result_processor.rb
Constant Summary collapse
- VERTEX_API_BASE_URL =
Global endpoint, not the job's region-specific one — matches the "aiplatform.googleapis.com" entry in default_intercept_addresses.yml so backend URL-shape classification stays consistent with the rest of the gem's Vertex traffic. The URL this produces always contains "/batchPredictionJobs/", which is also the default client-side exclude_api_patterns entry — that's harmless here since this class sends via BaseInterceptor/ApiService directly and never goes through NetHttpInterceptor's intercept/exclude filtering.
"https://aiplatform.googleapis.com/v1/"- SOURCE_API =
"vertex"- VALID_NAME_PATTERN =
%r{\Aprojects/[^/?#\s]+/locations/[^/?#\s]+/batchPredictionJobs/[^/?#\s]+\z}
Instance Attribute Summary collapse
-
#batch_info ⇒ Object
readonly
Returns the value of attribute batch_info.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #call(batch_results = []) ⇒ Object
-
#initialize(batch_info:, model: nil) ⇒ BatchResultProcessor
constructor
A new instance of BatchResultProcessor.
Constructor Details
#initialize(batch_info:, model: nil) ⇒ BatchResultProcessor
Returns a new instance of BatchResultProcessor.
22 23 24 25 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 22 def initialize(batch_info:, model: nil) @batch_info = batch_info @model = model end |
Instance Attribute Details
#batch_info ⇒ Object (readonly)
Returns the value of attribute batch_info.
20 21 22 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 20 def batch_info @batch_info end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
20 21 22 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 20 def model @model end |
Instance Method Details
#call(batch_results = []) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/coolhand/vertex/batch_result_processor.rb', line 27 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" process_completed_batch(batch_results) 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 |