Class: Runners::ServicesFactory

Inherits:
Object
  • Object
show all
Defined in:
app/services/runners/services_factory.rb

Defined Under Namespace

Classes: ServiceNotFoundForRunner

Constant Summary collapse

SERVICES =
{
  kubernetes: {
    update_node_status: Runners::Kubernetes::UpdateNodeStatus,
    node_availability: Runners::Kubernetes::NodeAvailability,
    run_task: Runners::Kubernetes::RunTask,
    kill_slot_runner: Runners::Kubernetes::KillSlotRunner,
    remove_runner: Runners::Kubernetes::RemoveRunner,
    fetch_logs: Runners::Kubernetes::FetchLogs,
    fetch_execution_info: Runners::Kubernetes::FetchExecutionInfo,
    filer: Runners::Kubernetes::Filer
  },
  docker: {
    update_node_status: Runners::Docker::UpdateNodeStatus,
    node_availability: Runners::Docker::NodeAvailability,
    run_task: Runners::Docker::RunTask,
    kill_slot_runner: Runners::Docker::KillSlotRunner,
    remove_runner: Runners::Docker::RemoveRunner,
    fetch_logs: Runners::Docker::FetchLogs,
    fetch_execution_info: Runners::Docker::FetchExecutionInfo,
    filer: Runners::Docker::Filer
  }
}.freeze

Class Method Summary collapse

Class Method Details

.fabricate(runner:, service:) ⇒ Object



30
31
32
33
34
35
36
# File 'app/services/runners/services_factory.rb', line 30

def self.fabricate(runner:, service:)
  service_class = SERVICES.dig(runner.to_sym, service)

  raise ServiceNotFoundForRunner, "No service #{service} found for #{runner}" unless service_class

  service_class.new
end