Module: Polyrun::Config::Effective

Defined in:
lib/polyrun/config/effective.rb

Overview

Nested hash of values Polyrun uses: loaded YAML (string keys) with overlays for merged prepare.env, resolved partition.shard_index / shard_total / shard_processes / timing_granularity, and top-level workers (POLYRUN_WORKERS default).

build memoizes the last (cfg, env) in-process so repeated dig calls on the same load do not rebuild the tree (single-threaded CLI).

Class Method Summary collapse

Class Method Details

.build(cfg, env: ENV) ⇒ Object

Per-thread cache avoids rebuilding the effective tree on repeated dig; no class ivars (RuboCop ThreadSafety).



15
16
17
18
19
# File 'lib/polyrun/config/effective.rb', line 15

def build(cfg, env: ENV)
  key = cache_key(cfg, env)
  per_thread = (Thread.current[:polyrun_effective_build] ||= {})
  per_thread[key] ||= build_uncached(cfg, env: env)
end

.dig(cfg, dotted_path, env: ENV) ⇒ Object



21
22
23
# File 'lib/polyrun/config/effective.rb', line 21

def dig(cfg, dotted_path, env: ENV)
  Polyrun::Config::DottedPath.dig(build(cfg, env: env), dotted_path)
end