Class: Slot

Inherits:
Object
  • Object
show all
Includes:
GlobalID::Identification, Mongoid::Document, Mongoid::Uuid, MongoidEnumerable
Defined in:
app/models/slot.rb

Instance Method Summary collapse

Instance Method Details

#mark_as_running(current_task:, runner_id:) ⇒ Object



30
31
32
# File 'app/models/slot.rb', line 30

def mark_as_running(current_task:, runner_id:)
  update!(status: :running, current_task: current_task, runner_id: runner_id)
end

#releaseObject



34
35
36
37
# File 'app/models/slot.rb', line 34

def release
  update!(status: :available, runner_id: nil, current_task: nil)
  RunTasksJob.perform_later(execution_type: execution_type)
end

#to_sObject



39
40
41
# File 'app/models/slot.rb', line 39

def to_s
  "Slot #{name} #{uuid} (#{status} runner_id: #{runner_id})"
end