Class: Runners::Docker::KillSlotRunner

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

Instance Method Summary collapse

Instance Method Details

#perform(slot:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/runners/docker/kill_slot_runner.rb', line 6

def perform(slot:)
  return unless slot.runner_id.present?

  ::Docker::Container
    .get(slot.runner_id, {}, CreateConnection.new.perform(node: slot.node))
    .kill!
rescue ::Docker::Error::NotFoundError => e
  Rails.logger.info("Container #{slot.runner_id} already removed - #{e.message} (e.class)")
rescue Excon::Error => e
  Rails.logger.info("Error removing container: #{e}")
end