Skip to main content

inferlab_runtime/
plan.rs

1use serde::{Deserialize, Serialize};
2use std::collections::BTreeMap;
3use std::path::PathBuf;
4
5#[derive(Clone, Debug, Deserialize, Serialize)]
6#[serde(tag = "kind", rename_all = "snake_case")]
7pub enum ReadinessPlan {
8    Http {
9        path: String,
10        /// `None` when the server is capture-armed: readiness remains
11        /// unbounded while process exit and interruption still terminate it.
12        timeout_seconds: Option<u64>,
13    },
14    HttpTargetRegistry {
15        readiness_path: String,
16        registry_path: String,
17        targets_field: String,
18        target_url_field: String,
19        target_role_field: String,
20        target_healthy_field: String,
21        target_bootstrap_port_field: String,
22        expected_targets: Vec<TargetRegistryExpectedTarget>,
23        timeout_seconds: Option<u64>,
24    },
25    ProcessAlive,
26}
27
28#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
29pub struct TargetRegistryExpectedTarget {
30    pub url: String,
31    pub role: String,
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub bootstrap_port: Option<u16>,
34}
35
36#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
37pub struct LaunchFilePlan {
38    pub relative_path: String,
39    pub resolved_path: PathBuf,
40    pub text: String,
41    pub sha256: String,
42}
43
44#[derive(Clone, Debug, Deserialize, Serialize)]
45#[serde(tag = "kind", rename_all = "kebab-case")]
46pub enum LaunchPlan {
47    Local,
48    Ssh { target: String },
49}
50
51#[derive(Clone, Debug, Deserialize, Serialize)]
52pub struct CommandPlan {
53    pub argv: Vec<String>,
54    pub env: BTreeMap<String, String>,
55    /// Variables explicitly rendered by resolution or an integration, as
56    /// distinct from ambient environment composed for local execution.
57    #[serde(default, skip_serializing_if = "Vec::is_empty")]
58    pub explicit_env: Vec<String>,
59    /// Names whose values flow from the launching machine into a
60    /// containerized process without projecting remote values into the plan.
61    #[serde(default, skip_serializing_if = "Vec::is_empty")]
62    pub pass_env: Vec<String>,
63    pub cwd: PathBuf,
64}
65
66#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
67pub struct ProcessEndpointPlan {
68    pub host: String,
69    pub port: u16,
70}