Treat Docker as a first-class provisioning provider for the local e2e cluster and add the weight-shard fetch/validate/bind lifecycle behind it. - docker_cluster_provisioning: model Docker as a provider adapter behind a `DockerCli` boundary (`run_container`/`inspect_ssh_endpoint`/`remove_force`) exposing only per-node ownership primitives - local_e2e_cluster: wire Docker provisioning into the e2e driver (default `swactor-mvp-local-e2e-cluster` image) across the bootstrap/teardown flow - weight_shards: add `ModelArtifactRef` (parses `hf://repo@rev/path`), `ShardAssignment`, `ShardManifest`, and `ValidatedShard` with digest-based validation - shard_fetch: add `ShardLocator` (digest/split/stage -> uri + cache key), `ShardCache`/`ShardFetcher` traits, a `ShardFetchCoordinator`, and typed `FetchError`s - shard_weight_lifecycle: add the `ShardWeightLifecycle` state machine (Idle->Assigned->Located->Fetching->Fetched->Validating->Binding->Ready/Faulted) with a `WorkerShardBinder` trait - provisioner/telemetry: route provision logs onto the datastream via per-node/stream channels (`submit_bytes`) and add shard_fetch/shard_weight_lifecycle/weight_shards guarantee tests Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
91 lines
2.8 KiB
Rust
91 lines
2.8 KiB
Rust
//! MVP-system-owned datastream channel records.
|
|
|
|
use datastream::frame::ChannelId;
|
|
use datastream::{ChannelRegistry, Record};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::observability_surface as obs;
|
|
use crate::provisioning::{self, ProvisionLogStream};
|
|
|
|
/// Structured MVP lifecycle facts: run, node, stage, edge, ring, object, step, and worker events.
|
|
pub const MVP_LIFECYCLE: &str = "mvp.lifecycle";
|
|
/// Structured node provisioning milestones emitted before a remote swactor runtime is live.
|
|
pub const MVP_PROVISIONING_EVENTS: &str = "mvp.provisioning.events";
|
|
|
|
/// Raw provider/process stream lines captured during provisioning.
|
|
pub const MVP_PROVISIONING_LOGS: &str = "mvp.provisioning.logs";
|
|
|
|
/// Datastream payload for the MVP lifecycle channel.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct MvpLifecycleRecord {
|
|
pub event: obs::Event,
|
|
}
|
|
|
|
impl MvpLifecycleRecord {
|
|
pub fn new(event: obs::Event) -> Self {
|
|
Self { event }
|
|
}
|
|
|
|
pub fn kind(&self) -> obs::EventKind {
|
|
self.event.kind()
|
|
}
|
|
}
|
|
|
|
impl From<obs::Event> for MvpLifecycleRecord {
|
|
fn from(event: obs::Event) -> Self {
|
|
Self::new(event)
|
|
}
|
|
}
|
|
|
|
impl Record for MvpLifecycleRecord {
|
|
const CHANNEL: &'static str = MVP_LIFECYCLE;
|
|
}
|
|
/// Datastream payload for provisioning lifecycle events.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct MvpProvisionEventRecord {
|
|
pub event: provisioning::ProvisionEvent,
|
|
}
|
|
|
|
impl MvpProvisionEventRecord {
|
|
pub fn new(event: provisioning::ProvisionEvent) -> Self {
|
|
Self { event }
|
|
}
|
|
}
|
|
|
|
impl Record for MvpProvisionEventRecord {
|
|
const CHANNEL: &'static str = MVP_PROVISIONING_EVENTS;
|
|
}
|
|
|
|
/// Datastream payload for provisioning stdout/stderr/provider lines.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct MvpProvisionLogRecord {
|
|
pub line: provisioning::ProvisionLogLine,
|
|
}
|
|
|
|
impl MvpProvisionLogRecord {
|
|
pub fn new(line: provisioning::ProvisionLogLine) -> Self {
|
|
Self { line }
|
|
}
|
|
}
|
|
|
|
pub fn mvp_provision_log_channel(node_id: u64, stream: ProvisionLogStream) -> ChannelId {
|
|
let stream = match stream {
|
|
ProvisionLogStream::Stdout => "stdout",
|
|
ProvisionLogStream::Stderr => "stderr",
|
|
ProvisionLogStream::Provider => "provider",
|
|
};
|
|
ChannelId::new(format!("mvp.provisioning.logs.node.{node_id}.{stream}"))
|
|
}
|
|
|
|
impl Record for MvpProvisionLogRecord {
|
|
const CHANNEL: &'static str = MVP_PROVISIONING_LOGS;
|
|
}
|
|
|
|
/// Registry fragment for consumers that want typed MVP datastream decoding.
|
|
pub fn channel_registry() -> ChannelRegistry {
|
|
let registry = ChannelRegistry::new().with_record::<MvpLifecycleRecord>();
|
|
let registry = registry
|
|
.with_record::<MvpProvisionEventRecord>()
|
|
.with_record::<MvpProvisionLogRecord>();
|
|
registry
|
|
}
|