Class: Flightdeck::ProcessRegistry::Node
- Inherits:
-
Struct
- Object
- Struct
- Flightdeck::ProcessRegistry::Node
- Defined in:
- app/models/flightdeck/process_registry.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#claimed_count ⇒ Object
Returns the value of attribute claimed_count.
-
#process ⇒ Object
Returns the value of attribute process.
Instance Method Summary collapse
- #claims_executions? ⇒ Boolean
-
#config_summary ⇒ Object
Human summary of what this process was configured to do.
- #dead? ⇒ Boolean
- #freshness ⇒ Object
- #heartbeat_age ⇒ Object
- #hostname ⇒ Object
- #id ⇒ Object
- #kind ⇒ Object
- #last_heartbeat_at ⇒ Object
- #metadata ⇒ Object
- #name ⇒ Object
- #pid ⇒ Object
- #prunable? ⇒ Boolean
- #supervisor? ⇒ Boolean
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children
14 15 16 |
# File 'app/models/flightdeck/process_registry.rb', line 14 def children @children end |
#claimed_count ⇒ Object
Returns the value of attribute claimed_count
14 15 16 |
# File 'app/models/flightdeck/process_registry.rb', line 14 def claimed_count @claimed_count end |
#process ⇒ Object
Returns the value of attribute process
14 15 16 |
# File 'app/models/flightdeck/process_registry.rb', line 14 def process @process end |
Instance Method Details
#claims_executions? ⇒ Boolean
22 |
# File 'app/models/flightdeck/process_registry.rb', line 22 def claims_executions? = kind == "Worker" |
#config_summary ⇒ Object
Human summary of what this process was configured to do. Keys differ per process kind, so known ones are formatted and anything else is shown verbatim rather than dropped.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/models/flightdeck/process_registry.rb', line 48 def config_summary parts = [] data = .symbolize_keys parts << "queues: #{data[:queues]}" if data[:queues].present? parts << "#{data[:thread_pool_size]} threads" if data[:thread_pool_size].present? parts << "batch #{data[:batch_size]}" if data[:batch_size].present? parts << "every #{data[:polling_interval]}s" if data[:polling_interval].present? parts << "#{Array(data[:recurring_schedule]).size} recurring tasks" if data[:recurring_schedule].present? known = %i[queues thread_pool_size batch_size polling_interval recurring_schedule concurrency_maintenance_interval] data.except(*known).each { |key, value| parts << "#{key}: #{value}" } parts.join(" ยท ") end |
#dead? ⇒ Boolean
38 |
# File 'app/models/flightdeck/process_registry.rb', line 38 def dead? = freshness == :dead |
#freshness ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/models/flightdeck/process_registry.rb', line 28 def freshness threshold = SolidQueue.process_alive_threshold age = heartbeat_age if age >= threshold then :dead elsif age >= threshold * FRESH_FRACTION then :stale else :fresh end end |
#heartbeat_age ⇒ Object
24 25 26 |
# File 'app/models/flightdeck/process_registry.rb', line 24 def heartbeat_age Time.current - last_heartbeat_at end |
#hostname ⇒ Object
18 |
# File 'app/models/flightdeck/process_registry.rb', line 18 def hostname = process.hostname |
#id ⇒ Object
15 |
# File 'app/models/flightdeck/process_registry.rb', line 15 def id = process.id |
#kind ⇒ Object
16 |
# File 'app/models/flightdeck/process_registry.rb', line 16 def kind = process.kind |
#last_heartbeat_at ⇒ Object
20 |
# File 'app/models/flightdeck/process_registry.rb', line 20 def last_heartbeat_at = process.last_heartbeat_at |
#metadata ⇒ Object
41 42 43 |
# File 'app/models/flightdeck/process_registry.rb', line 41 def process..presence || {} end |
#name ⇒ Object
17 |
# File 'app/models/flightdeck/process_registry.rb', line 17 def name = process.name |
#pid ⇒ Object
19 |
# File 'app/models/flightdeck/process_registry.rb', line 19 def pid = process.pid |
#prunable? ⇒ Boolean
39 |
# File 'app/models/flightdeck/process_registry.rb', line 39 def prunable? = dead? |
#supervisor? ⇒ Boolean
21 |
# File 'app/models/flightdeck/process_registry.rb', line 21 def supervisor? = kind == "Supervisor" |