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' => , 'pid' => 12345, 'tag' => 'myapp' 'concurrency' => 25, 'queues' => ['default', 'low'], 'busy' => 10, 'beat' => , 'identity' => , }

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Process

Returns a new instance of Process.



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

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



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

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

#dump_threads ⇒ Object



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

def dump_threads
  signal("TTIN")
end

#identity ⇒ Object



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

def identity
  self["identity"]
end

#labels ⇒ Object



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

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

#quiet! ⇒ Object



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

def quiet!
  signal("TSTP")
end

#stop! ⇒ Object



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

def stop!
  signal("TERM")
end

#stopping? ⇒ Boolean

Returns:

  • (Boolean)


882
883
884
# File 'lib/sidekiq/api.rb', line 882

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

#tag ⇒ Object



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

def tag
  self["tag"]
end