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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
use std::path::PathBuf;
use clap::Parser;
use clap_complete::Shell;
use clap_verbosity_flag::Verbosity;
#[derive(Debug, Parser)]
#[command(name = "gflowd", author, version = gflow::build_info::version(), about = "GFlow Daemon")]
#[command(styles=gflow::utils::STYLES)]
pub struct GFlowd {
#[command(subcommand)]
pub command: Option<Commands>,
/// The configuration file to use
#[arg(short, long, global = true)]
pub config: Option<PathBuf>,
/// Clean up the configuration file
#[arg(long, global = true)]
pub cleanup: bool,
/// GPU indices restriction (internal use, set by 'gflowd up --gpus')
#[arg(long, hide = true)]
pub gpus_internal: Option<String>,
/// GPU allocation strategy override (internal use, set by 'gflowd up --gpu-allocation-strategy')
#[arg(long, hide = true)]
pub gpu_allocation_strategy_internal: Option<String>,
#[command(flatten)]
pub verbosity: Verbosity,
}
#[derive(Debug, Parser)]
pub enum Commands {
/// Create or update the configuration file via a guided wizard
Init {
/// Accept all defaults (non-interactive)
#[arg(long)]
yes: bool,
/// Overwrite existing configuration file
#[arg(long)]
force: bool,
/// Configure advanced options (notifications, etc.)
#[arg(long)]
advanced: bool,
/// Limit which GPUs the scheduler can use (e.g., "0,2" or "0-2")
#[arg(long, value_name = "INDICES")]
gpus: Option<String>,
/// Daemon host (default: localhost)
#[arg(long, value_name = "HOST")]
host: Option<String>,
/// Daemon port (default: 59000)
#[arg(long, value_name = "PORT")]
port: Option<u16>,
/// Timezone to store in config (e.g., "Asia/Shanghai", "UTC"). Use "local" to leave unset.
#[arg(long, value_name = "TZ")]
timezone: Option<String>,
/// GPU allocation strategy: sequential or random
#[arg(long, value_name = "STRATEGY")]
gpu_allocation_strategy: Option<String>,
},
/// Start the daemon in a tmux session
Up {
/// Limit which GPUs the scheduler can use (e.g., "0,2" or "0-2")
#[arg(long, value_name = "INDICES")]
gpus: Option<String>,
/// GPU allocation strategy: sequential or random
#[arg(long, value_name = "STRATEGY")]
gpu_allocation_strategy: Option<String>,
},
/// Stop the daemon
Down,
/// Restart the daemon
Restart {
/// Limit which GPUs the scheduler can use (e.g., "0,2" or "0-2")
#[arg(long, value_name = "INDICES")]
gpus: Option<String>,
/// GPU allocation strategy: sequential or random
#[arg(long, value_name = "STRATEGY")]
gpu_allocation_strategy: Option<String>,
},
/// Reload the daemon with zero downtime
Reload {
/// Limit which GPUs the scheduler can use (e.g., "0,2" or "0-2")
#[arg(long, value_name = "INDICES")]
gpus: Option<String>,
/// GPU allocation strategy: sequential or random
#[arg(long, value_name = "STRATEGY")]
gpu_allocation_strategy: Option<String>,
},
/// Show the daemon status
Status,
/// Generate shell completion scripts
Completion {
/// The shell to generate completions for
#[arg(value_enum)]
shell: Shell,
},
}