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.



732
733
734
# File 'lib/sidekiq/api.rb', line 732

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



744
745
746
# File 'lib/sidekiq/api.rb', line 744

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

#dump_threadsObject



756
757
758
# File 'lib/sidekiq/api.rb', line 756

def dump_threads
  signal('TTIN')
end

#labelsObject



740
741
742
# File 'lib/sidekiq/api.rb', line 740

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

#quiet!Object



748
749
750
# File 'lib/sidekiq/api.rb', line 748

def quiet!
  signal('USR1')
end

#stop!Object



752
753
754
# File 'lib/sidekiq/api.rb', line 752

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


760
761
762
# File 'lib/sidekiq/api.rb', line 760

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

#tagObject



736
737
738
# File 'lib/sidekiq/api.rb', line 736

def tag
  self['tag']
end