1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Remote command arguments
//!
//! Commands for managing the mecha10-remote container which runs AI/ML nodes
//! in Docker containers with platform-specific dependencies.
use super::build::TargetArch;
use clap::{Args, Subcommand};
/// Remote node management subcommands
#[derive(Subcommand)]
pub enum RemoteCommand {
/// Start the remote node container
///
/// Automatically detects whether to use the pre-built image or build locally:
/// - Uses pre-built if only @mecha10/* nodes and Dockerfile.remote is unmodified
/// - Builds locally if custom @local/* nodes or modified Dockerfile.remote
Up(#[command(flatten)] RemoteUpArgs),
/// Stop the remote node container
Down,
/// View logs from remote nodes
Logs(#[command(flatten)] RemoteLogsArgs),
/// List running remote nodes
Ps,
/// Build the remote container (even if pre-built is available)
Build,
}
/// Arguments for the `remote up` command
#[derive(Args)]
pub struct RemoteUpArgs {
/// Force rebuild even if pre-built image is available
#[arg(long)]
pub build: bool,
/// Detach and run in background
#[arg(short, long)]
pub detach: bool,
/// Target architecture (x86-64 or aarch64)
#[arg(short, long, value_enum, default_value_t = TargetArch::X86_64)]
pub arch: TargetArch,
}
/// Arguments for the `remote logs` command
#[derive(Args)]
pub struct RemoteLogsArgs {
/// Specific node to view logs for (e.g., object-detector)
/// If not specified, shows logs from all remote nodes
pub node: Option<String>,
/// Follow log output (like tail -f)
#[arg(short, long)]
pub follow: bool,
/// Number of lines to show from the end
#[arg(short = 'n', long, default_value = "100")]
pub tail: u32,
}