Class: Legion::Extensions::Llm::Mlx::Actor::DiscoveryRefresh
- Inherits:
-
Actors::Every
- Object
- Actors::Every
- Legion::Extensions::Llm::Mlx::Actor::DiscoveryRefresh
- Includes:
- Inventory::ScopedRefresher, Logging::Helper
- Defined in:
- lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb
Overview
rubocop:disable Style/Documentation, Metrics/ClassLength
Class Method Summary collapse
Instance Method Summary collapse
- #check_subtask? ⇒ Boolean
- #compute_lanes_for_scope ⇒ Object
- #credential_hash ⇒ Object
- #generate_task? ⇒ Boolean
- #manual ⇒ Object
- #run_now? ⇒ Boolean
- #runner_class ⇒ Object
- #runner_function ⇒ Object
- #scope_key ⇒ Object
- #time ⇒ Object
- #use_runner? ⇒ Boolean
Class Method Details
.every_seconds ⇒ Object
31 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 31 def self.every_seconds = 60 |
Instance Method Details
#check_subtask? ⇒ Boolean
37 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 37 def check_subtask? = false |
#compute_lanes_for_scope ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 50 def compute_lanes_for_scope(**) return [] unless defined?(Legion::LLM::Call::Registry) mlx_instances.flat_map { |entry| lanes_for_instance(entry) } rescue StandardError => e handle_exception(e, level: :warn, handled: true, operation: 'mlx.discovery_refresh.compute_lanes') [] end |
#credential_hash ⇒ Object
59 60 61 62 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 59 def credential_hash(**) mlx_settings = Legion::Settings.dig(:extensions, :llm, :mlx) || {} Digest::SHA256.hexdigest(mlx_settings[:api_key].to_s + mlx_settings[:instances].to_s)[0, 16] end |
#generate_task? ⇒ Boolean
38 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 38 def generate_task? = false |
#manual ⇒ Object
64 65 66 67 68 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 64 def manual(**) tick if respond_to?(:tick) rescue StandardError => e handle_exception(e, level: :warn, handled: true, operation: 'mlx.actor.discovery_refresh') end |
#run_now? ⇒ Boolean
35 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 35 def run_now? = true |
#runner_class ⇒ Object
33 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 33 def runner_class = self.class |
#runner_function ⇒ Object
34 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 34 def runner_function = 'manual' |
#scope_key ⇒ Object
46 47 48 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 46 def scope_key(**) { provider: :mlx } end |
#time ⇒ Object
40 41 42 43 44 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 40 def time return self.class.every_seconds unless defined?(Legion::Settings) Legion::Settings.dig(:extensions, :llm, :mlx, :discovery_interval) || self.class.every_seconds end |
#use_runner? ⇒ Boolean
36 |
# File 'lib/legion/extensions/llm/mlx/actors/discovery_refresh.rb', line 36 def use_runner? = false |