pub struct Forge { /* private fields */ }Expand description
Main Forge runtime
Implementations§
Source§impl Forge
impl Forge
Sourcepub async fn state(&self) -> RuntimeState
pub async fn state(&self) -> RuntimeState
Get current runtime state
Sourcepub fn uptime_secs(&self) -> u64
pub fn uptime_secs(&self) -> u64
Get uptime in seconds
Sourcepub fn metrics(&self) -> Option<&Arc<ForgeMetrics>>
pub fn metrics(&self) -> Option<&Arc<ForgeMetrics>>
Get metrics instance
Sourcepub fn store(&self) -> &BoxedStateStore
pub fn store(&self) -> &BoxedStateStore
Get the state store
Sourcepub fn router(&self) -> &BoxedMoERouter
pub fn router(&self) -> &BoxedMoERouter
Get the MoE router
Sourcepub fn register_node(&self, node: NodeResources)
pub fn register_node(&self, node: NodeResources)
Register a node available to the embedded scheduler / reconcile loop.
Register nodes before Forge::run, which seeds the reconcile loop with
the registered set.
Sourcepub async fn new_reconciler(&self) -> Result<Reconciler>
pub async fn new_reconciler(&self) -> Result<Reconciler>
Build a Reconciler that shares this runtime’s state store and is
seeded with the registered nodes. The reconciler converges submitted jobs
(persisted under keys::JOBS) onto node assignments.
Forge::run spawns one automatically; this is exposed for tests and
advanced embedding. It uses a fresh autoscaler with the same config as the
runtime’s — the reconciler is the autoscaling authority for the loop.
Sourcepub fn signal_shutdown(&self)
pub fn signal_shutdown(&self)
Signal shutdown
Sourcepub fn shutdown_receiver(&self) -> Receiver<()>
pub fn shutdown_receiver(&self) -> Receiver<()>
Subscribe to shutdown signal
Sourcepub async fn submit_job(&self, job: Job) -> Result<String>
pub async fn submit_job(&self, job: Job) -> Result<String>
Submit a job
Sourcepub async fn submit_sim_cell(&self, cell: SimCell) -> Result<String>
pub async fn submit_sim_cell(&self, cell: SimCell) -> Result<String>
Submit a simulation cell (world shard + co-resident agent policies) for
gang scheduling. Persisted under keys::simcell(id); the reconcile loop
picks it up and gang-schedules its members all-or-nothing (co-located per
the cell’s crate::scheduler::sim::CoPlacement).
Sourcepub async fn scale_job(
&self,
job_id: &str,
group: &str,
count: u32,
) -> Result<()>
pub async fn scale_job( &self, job_id: &str, group: &str, count: u32, ) -> Result<()>
Scale a job’s task group
Sourcepub async fn route(&self, input: &str) -> RouteResult
pub async fn route(&self, input: &str) -> RouteResult
Route an input to an expert
Sourcepub fn register_expert(&self, expert: Expert)
pub fn register_expert(&self, expert: Expert)
Register an expert
Sourcepub fn update_expert_load(&self, index: usize, load: f64)
pub fn update_expert_load(&self, index: usize, load: f64)
Update expert load
Sourcepub async fn evaluate_scaling(
&self,
job_id: &str,
cpu: f64,
memory: f64,
instances: u32,
) -> ScalingDecision
pub async fn evaluate_scaling( &self, job_id: &str, cpu: f64, memory: f64, instances: u32, ) -> ScalingDecision
Evaluate autoscaling for a job