pub trait NodeProvider: Send + Sync {
// Required methods
fn provision_nodes(&self, count: usize) -> Result<usize>;
fn terminate_nodes(&self, count: usize) -> Result<usize>;
}Expand description
Something that can actually provision or terminate compute nodes on a real cluster substrate (a cloud autoscaling group, Kubernetes, Slurm, an in-house fleet manager, …).
AutoScaler has no such substrate of its own: without one attached via
AutoScaler::with_node_provider, the execution step of a scaling
decision (reached through AutoScaler::update_and_scale) returns
TrustformersError::invalid_state instead of mutating
AutoScaler::get_current_nodes for nodes that were never actually
requested or terminated. For an explicit dry run (benchmarks, demos,
tests) that wants update_and_scale to always succeed without a real
substrate, attach SimulatedNodeProvider instead – it is honest about
being a simulation because its name says so, not because it pretends to
be real.
Required Methods§
Sourcefn provision_nodes(&self, count: usize) -> Result<usize>
fn provision_nodes(&self, count: usize) -> Result<usize>
Request count additional compute nodes. Returns the number that
were actually provisioned – implementations must not report more
than what was genuinely started, and may return fewer than count
if capacity is limited.
Sourcefn terminate_nodes(&self, count: usize) -> Result<usize>
fn terminate_nodes(&self, count: usize) -> Result<usize>
Terminate count compute nodes. Returns the number that were
actually terminated.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".