Class: Sidekiq::Process
- Inherits:
-
Object
- Object
- Sidekiq::Process
- 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>,
'embedded' => true,
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#dump_threads ⇒ Object
Signal this process to log backtraces for all threads.
- #embedded? ⇒ Boolean
- #identity ⇒ Object
- #labels ⇒ Object
- #queues ⇒ Object
-
#quiet! ⇒ Object
Signal this process to stop processing new jobs.
-
#stop! ⇒ Object
Signal this process to shutdown.
-
#stopping? ⇒ Boolean
True if this process is quiet or shutting down.
- #tag ⇒ Object
- #version ⇒ Object
- #weights ⇒ Object
Instance Method Details
#[](key) ⇒ Object
1084 1085 1086 |
# File 'lib/sidekiq/api.rb', line 1084 def [](key) @attribs[key] end |
#dump_threads ⇒ Object
Signal this process to log backtraces for all threads. Useful if you have a frozen or deadlocked process which is still sending a heartbeat. This method is asynchronous and it can take 5-10 seconds.
1132 1133 1134 |
# File 'lib/sidekiq/api.rb', line 1132 def dump_threads signal("TTIN") end |
#embedded? ⇒ Boolean
1104 1105 1106 |
# File 'lib/sidekiq/api.rb', line 1104 def self["embedded"] end |
#identity ⇒ Object
1088 1089 1090 |
# File 'lib/sidekiq/api.rb', line 1088 def identity self["identity"] end |
#labels ⇒ Object
1080 1081 1082 |
# File 'lib/sidekiq/api.rb', line 1080 def labels self["labels"].to_a end |
#queues ⇒ Object
1092 1093 1094 |
# File 'lib/sidekiq/api.rb', line 1092 def queues self["queues"] end |
#quiet! ⇒ Object
Signal this process to stop processing new jobs. It will continue to execute jobs it has already fetched. This method is asynchronous and it can take 5-10 seconds for the process to quiet.
1112 1113 1114 1115 1116 |
# File 'lib/sidekiq/api.rb', line 1112 def quiet! raise "Can't quiet an embedded process" if signal("TSTP") end |
#stop! ⇒ Object
Signal this process to shutdown. It will shutdown within its configured :timeout value, default 25 seconds. This method is asynchronous and it can take 5-10 seconds for the process to start shutting down.
1122 1123 1124 1125 1126 |
# File 'lib/sidekiq/api.rb', line 1122 def stop! raise "Can't stop an embedded process" if signal("TERM") end |
#stopping? ⇒ Boolean
Returns true if this process is quiet or shutting down.
1137 1138 1139 |
# File 'lib/sidekiq/api.rb', line 1137 def stopping? self["quiet"] == "true" end |
#tag ⇒ Object
1076 1077 1078 |
# File 'lib/sidekiq/api.rb', line 1076 def tag self["tag"] end |
#version ⇒ Object
1100 1101 1102 |
# File 'lib/sidekiq/api.rb', line 1100 def version self["version"] end |
#weights ⇒ Object
1096 1097 1098 |
# File 'lib/sidekiq/api.rb', line 1096 def weights self["weights"] end |