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.



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

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



840
841
842
# File 'lib/sidekiq/api.rb', line 840

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

#dump_threadsObject



856
857
858
# File 'lib/sidekiq/api.rb', line 856

def dump_threads
  signal('TTIN')
end

#identityObject



844
845
846
# File 'lib/sidekiq/api.rb', line 844

def identity
  self['identity']
end

#labelsObject



836
837
838
# File 'lib/sidekiq/api.rb', line 836

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

#quiet!Object



848
849
850
# File 'lib/sidekiq/api.rb', line 848

def quiet!
  signal('TSTP')
end

#stop!Object



852
853
854
# File 'lib/sidekiq/api.rb', line 852

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


860
861
862
# File 'lib/sidekiq/api.rb', line 860

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

#tagObject



832
833
834
# File 'lib/sidekiq/api.rb', line 832

def tag
  self['tag']
end