Class: Sidekiq::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/api.rb

Overview

Sidekiq::Process represents an active Sidekiq process talking with Redis. Each process has a set of attributes which look like this:

'hostname' => 'app-1.example.com',
'started_at' => <process start time>,
'pid' => 12345,
'tag' => 'myapp'
'concurrency' => 25,
'queues' => ['default', 'low'],
'busy' => 10,
'beat' => <last heartbeat>,
'identity' => <unique string identifying the process>,

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Process

Returns a new instance of Process.



796
797
798
# File 'lib/sidekiq/api.rb', line 796

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



808
809
810
# File 'lib/sidekiq/api.rb', line 808

def [](key)
  @attribs[key]
end

#dump_threadsObject



824
825
826
# File 'lib/sidekiq/api.rb', line 824

def dump_threads
  signal('TTIN')
end

#identityObject



812
813
814
# File 'lib/sidekiq/api.rb', line 812

def identity
  self['identity']
end

#labelsObject



804
805
806
# File 'lib/sidekiq/api.rb', line 804

def labels
  Array(self['labels'])
end

#quiet!Object



816
817
818
# File 'lib/sidekiq/api.rb', line 816

def quiet!
  signal('TSTP')
end

#stop!Object



820
821
822
# File 'lib/sidekiq/api.rb', line 820

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


828
829
830
# File 'lib/sidekiq/api.rb', line 828

def stopping?
  self['quiet'] == 'true'
end

#tagObject



800
801
802
# File 'lib/sidekiq/api.rb', line 800

def tag
  self['tag']
end