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.



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

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



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

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

#dump_threadsObject



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

def dump_threads
  signal('TTIN')
end

#identityObject



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

def identity
  self['identity']
end

#labelsObject



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

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

#quiet!Object



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

def quiet!
  signal('TSTP')
end

#stop!Object



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

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


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

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

#tagObject



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

def tag
  self['tag']
end