Class: MissionControl::Jobs::Worker

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/mission_control/jobs/worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(queue_adapter: ActiveJob::Base.queue_adapter, **kwargs) ⇒ Worker

Returns a new instance of Worker.



6
7
8
9
# File 'app/models/mission_control/jobs/worker.rb', line 6

def initialize(queue_adapter: ActiveJob::Base.queue_adapter, **kwargs)
  @queue_adapter = queue_adapter
  super(**kwargs)
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



4
5
6
# File 'app/models/mission_control/jobs/worker.rb', line 4

def configuration
  @configuration
end

#hostnameObject

Returns the value of attribute hostname.



4
5
6
# File 'app/models/mission_control/jobs/worker.rb', line 4

def hostname
  @hostname
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'app/models/mission_control/jobs/worker.rb', line 4

def id
  @id
end

#last_heartbeat_atObject

Returns the value of attribute last_heartbeat_at.



4
5
6
# File 'app/models/mission_control/jobs/worker.rb', line 4

def last_heartbeat_at
  @last_heartbeat_at
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'app/models/mission_control/jobs/worker.rb', line 4

def name
  @name
end

#raw_dataObject

Returns the value of attribute raw_data.



4
5
6
# File 'app/models/mission_control/jobs/worker.rb', line 4

def raw_data
  @raw_data
end

Instance Method Details

#jobsObject



11
12
13
# File 'app/models/mission_control/jobs/worker.rb', line 11

def jobs
  @jobs ||= ActiveJob::JobsRelation.new(queue_adapter: queue_adapter).in_progress.where(worker_id: id)
end