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.



742
743
744
# File 'lib/sidekiq/api.rb', line 742

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



754
755
756
# File 'lib/sidekiq/api.rb', line 754

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

#dump_threadsObject



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

def dump_threads
  signal('TTIN')
end

#labelsObject



750
751
752
# File 'lib/sidekiq/api.rb', line 750

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

#quiet!Object



758
759
760
# File 'lib/sidekiq/api.rb', line 758

def quiet!
  signal('USR1')
end

#stop!Object



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

def stop!
  signal('TERM')
end

#stopping?Boolean

Returns:

  • (Boolean)


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

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

#tagObject



746
747
748
# File 'lib/sidekiq/api.rb', line 746

def tag
  self['tag']
end