MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / main

Function main

supervisor/client/src/main.rs:49–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47
48#[tokio::main]
49async fn main() -> Result<()> {
50 {
51 use tracing_subscriber::{fmt, EnvFilter};
52 let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
53 fmt().with_env_filter(filter).with_ansi(false).init();
54 }
55
56 let cli = Cli::parse();
57 let client = SupervisorClient::new(&cli.base_url);
58
59 match cli.command {
60 Commands::Deploy { id, command, args } => {
61 let config = ProcessConfig {
62 id,
63 name: String::new(),
64 command,
65 args,
66 env: Default::default(),
67 cwd: String::new(),
68 stdout: String::new(),
69 stderr: String::new(),
70 pidfile: String::new(),
71 cid: None,
72 note: String::new(),
73 };
74 print_json(&client.deploy(&config).await?);
75 }
76 Commands::Start { id } => {
77 print_json(&client.start(&id).await?);
78 }
79 Commands::Stop { id } => {
80 print_json(&client.stop(&id).await?);
81 }
82 Commands::Remove { id } => {
83 print_json(&client.remove(&id).await?);
84 }
85 Commands::List => {
86 print_json(&client.list().await?);
87 }
88 Commands::Info { id } => {
89 print_json(&client.info(&id).await?);
90 }
91 Commands::Ping => {
92 print_json(&client.ping().await?);
93 }
94 Commands::Clear => {
95 print_json(&client.clear().await?);
96 }
97 Commands::Shutdown => {
98 print_json(&client.shutdown().await?);
99 }
100 }
101 Ok(())
102}
103
104fn print_json<T: serde::Serialize>(value: &T) {
105 println!("{}", serde_json::to_string(value).unwrap());

Callers

nothing calls this directly

Calls 10

print_jsonFunction · 0.85
pingMethod · 0.80
deployMethod · 0.45
startMethod · 0.45
stopMethod · 0.45
removeMethod · 0.45
listMethod · 0.45
infoMethod · 0.45
clearMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected