Files
ubicloud/model/ai/inference_endpoint_replica.rb
Benjamin Satzger a49d018713 Avoid creating short-lived pages for inference endpoints
The load_balancers_vms table includes state and state_counter columns
for each VM associated with a load balancer. To make this relationship
explicit for inference endpoint replicas, we establish a
load_balancers_vm relationship.

This relationship serves two key purposes:
  1. To determine the availability of a replica.
  2. To ensure that a page is created only if a replica has been down
     for a duration exceeding the health_check_down_threshold.
2024-12-04 17:28:07 +01:00

29 lines
1.1 KiB
Ruby

# frozen_string_literal: true
require_relative "../../model"
class InferenceEndpointReplica < Sequel::Model
one_to_one :strand, key: :id
one_to_one :vm, key: :id, primary_key: :vm_id
many_to_one :inference_endpoint
one_to_one :load_balancers_vm, class: LoadBalancersVms, key: :vm_id, primary_key: :vm_id
include ResourceMethods
include SemaphoreMethods
semaphore :destroy
end
# Table: inference_endpoint_replica
# Columns:
# id | uuid | PRIMARY KEY
# created_at | timestamp with time zone | NOT NULL DEFAULT now()
# inference_endpoint_id | uuid | NOT NULL
# vm_id | uuid | NOT NULL
# Indexes:
# inference_endpoint_replica_pkey | PRIMARY KEY btree (id)
# inference_endpoint_replica_vm_id_key | UNIQUE btree (vm_id)
# Foreign key constraints:
# inference_endpoint_replica_inference_endpoint_id_fkey | (inference_endpoint_id) REFERENCES inference_endpoint(id)
# inference_endpoint_replica_vm_id_fkey | (vm_id) REFERENCES vm(id)