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.



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

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



773
774
775
# File 'lib/sidekiq/api.rb', line 773

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

#dump_threadsObject



785
786
787
# File 'lib/sidekiq/api.rb', line 785

def dump_threads
  signal('TTIN')
end

#labelsObject



769
770
771
# File 'lib/sidekiq/api.rb', line 769

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

#quiet!Object



777
778
779
# File 'lib/sidekiq/api.rb', line 777

def quiet!
  signal('TSTP')
end

#stop!Object



781
782
783
# File 'lib/sidekiq/api.rb', line 781

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


789
790
791
# File 'lib/sidekiq/api.rb', line 789

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

#tagObject



765
766
767
# File 'lib/sidekiq/api.rb', line 765

def tag
  self['tag']
end