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.



893
894
895
# File 'lib/sidekiq/api.rb', line 893

def initialize(hash)
  @attribs = hash
end

Instance Method Details

#[](key) ⇒ Object



905
906
907
# File 'lib/sidekiq/api.rb', line 905

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

#dump_threadsObject



925
926
927
# File 'lib/sidekiq/api.rb', line 925

def dump_threads
  signal("TTIN")
end

#identityObject



909
910
911
# File 'lib/sidekiq/api.rb', line 909

def identity
  self["identity"]
end

#labelsObject



901
902
903
# File 'lib/sidekiq/api.rb', line 901

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

#queuesObject



913
914
915
# File 'lib/sidekiq/api.rb', line 913

def queues
  self["queues"]
end

#quiet!Object



917
918
919
# File 'lib/sidekiq/api.rb', line 917

def quiet!
  signal("TSTP")
end

#stop!Object



921
922
923
# File 'lib/sidekiq/api.rb', line 921

def stop!
  signal("TERM")
end

#stopping?Boolean

Returns:

  • (Boolean)


929
930
931
# File 'lib/sidekiq/api.rb', line 929

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

#tagObject



897
898
899
# File 'lib/sidekiq/api.rb', line 897

def tag
  self["tag"]
end