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.



822
823
824
# File 'lib/sidekiq/api.rb', line 822

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



834
835
836
# File 'lib/sidekiq/api.rb', line 834

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

#dump_threadsObject



850
851
852
# File 'lib/sidekiq/api.rb', line 850

def dump_threads
  signal('TTIN')
end

#identityObject



838
839
840
# File 'lib/sidekiq/api.rb', line 838

def identity
  self['identity']
end

#labelsObject



830
831
832
# File 'lib/sidekiq/api.rb', line 830

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

#quiet!Object



842
843
844
# File 'lib/sidekiq/api.rb', line 842

def quiet!
  signal('TSTP')
end

#stop!Object



846
847
848
# File 'lib/sidekiq/api.rb', line 846

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


854
855
856
# File 'lib/sidekiq/api.rb', line 854

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

#tagObject



826
827
828
# File 'lib/sidekiq/api.rb', line 826

def tag
  self['tag']
end