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.


847
848
849
# File 'lib/sidekiq/api.rb', line 847

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object


859
860
861
# File 'lib/sidekiq/api.rb', line 859

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

#dump_threadsObject


875
876
877
# File 'lib/sidekiq/api.rb', line 875

def dump_threads
  signal("TTIN")
end

#identityObject


863
864
865
# File 'lib/sidekiq/api.rb', line 863

def identity
  self["identity"]
end

#labelsObject


855
856
857
# File 'lib/sidekiq/api.rb', line 855

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

#quiet!Object


867
868
869
# File 'lib/sidekiq/api.rb', line 867

def quiet!
  signal("TSTP")
end

#stop!Object


871
872
873
# File 'lib/sidekiq/api.rb', line 871

def stop!
  signal("TERM")
end

#stopping?Boolean

Returns:

  • (Boolean)

879
880
881
# File 'lib/sidekiq/api.rb', line 879

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

#tagObject


851
852
853
# File 'lib/sidekiq/api.rb', line 851

def tag
  self["tag"]
end