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.



783
784
785
# File 'lib/sidekiq/api.rb', line 783

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



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

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

#dump_threadsObject



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

def dump_threads
  signal('TTIN')
end

#identityObject



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

def identity
  self['identity']
end

#labelsObject



791
792
793
# File 'lib/sidekiq/api.rb', line 791

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

#quiet!Object



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

def quiet!
  signal('TSTP')
end

#stop!Object



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

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


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

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

#tagObject



787
788
789
# File 'lib/sidekiq/api.rb', line 787

def tag
  self['tag']
end