Class: Legion::Extensions::Llm::Discovery::Actor
- Inherits:
-
Actors::Every
- Object
- Actors::Every
- Legion::Extensions::Llm::Discovery::Actor
- Includes:
- Helpers::Lex
- Defined in:
- lib/legion/extensions/llm/discovery/actor.rb
Overview
Base periodic discovery actor for EVERY lex-llm-* provider. This is the interface: a provider subclasses it with an EMPTY body and gets discovery for free —
module Vllm
module Actor
class Discovery < Legion::Extensions::Llm::Discovery::Actor; end
end
end
It fires on the configured discovery interval and dispatches each tick
to the provider's Runners::Discovery module (resolved by convention
from this actor's own namespace), which mixes in Discovery::Pipeline
and owns the provider-specific fetch/health/evidence/callable. Every
generic decision lives in the pipeline; a provider overrides a single
method only when its runner lives somewhere non-conventional or its
teardown differs.
Dispatch contract (Every -> Actors::Base#manual): use_runner? = false
calls the runner MODULE's refresh directly (no Legion::Runner task —
the state and the Registry are process-local, so it must run on the
owning node); run_now? = true fires once on boot then every time
seconds.
Instance Method Summary collapse
- #run_now? ⇒ Boolean
-
#runner_class ⇒ Object
The provider's discovery runner module, resolved by convention from this actor's namespace:
::Runners::Discovery. - #runner_function ⇒ Object
- #shutdown ⇒ Object
-
#time ⇒ Object
Honor the registered discovery interval.
- #use_runner? ⇒ Boolean
Instance Method Details
#run_now? ⇒ Boolean
51 |
# File 'lib/legion/extensions/llm/discovery/actor.rb', line 51 def run_now? = true |
#runner_class ⇒ Object
The provider's discovery runner module, resolved by convention from
this actor's namespace:
58 59 60 |
# File 'lib/legion/extensions/llm/discovery/actor.rb', line 58 def runner_class "#{provider_namespace}::Runners::Discovery" end |
#runner_function ⇒ Object
53 |
# File 'lib/legion/extensions/llm/discovery/actor.rb', line 53 def runner_function = 'refresh' |
#shutdown ⇒ Object
71 72 73 74 75 |
# File 'lib/legion/extensions/llm/discovery/actor.rb', line 71 def shutdown Kernel.const_get(runner_class).remove_all_instances rescue StandardError => e handle_exception(e, level: :warn, operation: "#{provider_slug}.actor.discovery.shutdown") end |
#time ⇒ Object
Honor the registered discovery interval. A nil TimerTask interval fires once and then stops, so resolve to the registered default (300s) whenever the setting is missing or non-positive.
65 66 67 68 69 |
# File 'lib/legion/extensions/llm/discovery/actor.rb', line 65 def time interval = settings.dig(:instances, :default, :discovery_interval)&.to_i || settings.dig(:discovery, :interval_seconds)&.to_i interval&.positive? ? interval : 300 end |
#use_runner? ⇒ Boolean
52 |
# File 'lib/legion/extensions/llm/discovery/actor.rb', line 52 def use_runner? = false |