Skip to content

Commit 0c2e2e4

Browse files
mariusaemeta-codesync[bot]
authored andcommitted
hyper is dead! long live hyper! (#1924)
Summary: Pull Request resolved: #1924 Revive the hyper command: * rip out old dependencies, whittle it down to 'list' and 'show' * support for proc enumeration and state inspection ... to be continued ghstack-source-id: 327072953 exported-using-ghexport Reviewed By: vidhyav Differential Revision: D87370648 fbshipit-source-id: 5d734b5629e0f8e7bdaccc39545a76ed3079af77
1 parent 9cf8a09 commit 0c2e2e4

File tree

19 files changed

+145
-3089
lines changed

19 files changed

+145
-3089
lines changed

hyper/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file is manually maintained to maintain the abilith to build hyper
1+
# This file is manually maintained to maintain the ability to build hyper
22
# using cargo. The code is annotated with fbcode_build conditionals such that
33
# it works with both cargo (all oss deps) and buck (full meta deps).
44
[package]
@@ -15,7 +15,7 @@ chrono = { version = "0.4.41", features = ["clock", "serde", "std"], default-fea
1515
clap = { version = "4.5.30", features = ["derive", "env", "string", "unicode", "wrap_help"] }
1616
console = "0.15.7"
1717
hyperactor = { path = "../hyperactor" }
18-
hyperactor_multiprocess = { path = "../hyperactor_multiprocess" }
18+
hyperactor_mesh = { path = "../hyperactor_mesh" }
1919
serde = { version = "1.0.185", features = ["derive", "rc"] }
2020
serde_json = { version = "1.0.132", features = ["float_roundtrip", "unbounded_depth"] }
2121
tabwriter = { version = "1.2.1", features = ["ansi_formatting"] }

hyper/src/commands.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,5 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
pub mod demo;
10-
pub mod procs;
11-
pub mod serve;
9+
pub mod list;
1210
pub mod show;
13-
#[cfg(fbcode_build)]
14-
pub mod top;

hyper/src/commands/demo.rs

Lines changed: 0 additions & 256 deletions
This file was deleted.

hyper/src/commands/list.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
use hyperactor::ActorRef;
10+
use hyperactor::channel::ChannelAddr;
11+
use hyperactor::reference::ProcId;
12+
use hyperactor_mesh::proc_mesh::global_root_client;
13+
use hyperactor_mesh::resource::ListClient;
14+
use hyperactor_mesh::v1::host_mesh::mesh_agent::HostMeshAgent;
15+
16+
#[derive(clap::Args, Debug)]
17+
pub struct ListCommand {
18+
/// The reference to the resource to list.
19+
/// TODO: this is a temporary workaround:
20+
/// formalize parsing host refs, etc.
21+
reference: String,
22+
}
23+
24+
impl ListCommand {
25+
pub async fn run(self) -> anyhow::Result<()> {
26+
let host: ChannelAddr = self.reference.parse().map_err(|e| {
27+
anyhow::anyhow!(
28+
"could not parse '{}' as a host reference: {}",
29+
self.reference,
30+
e
31+
)
32+
})?;
33+
34+
let client = global_root_client();
35+
36+
// Codify obtaining a proc's agent in `hyperactor_mesh` somewhere.
37+
let agent: ActorRef<HostMeshAgent> =
38+
ActorRef::attest(ProcId::Direct(host, "service".to_string()).actor_id("agent", 0));
39+
40+
let resources = agent.list(&client).await?;
41+
println!("{}", serde_json::to_string_pretty(&resources)?);
42+
43+
Ok(())
44+
}
45+
}

0 commit comments

Comments
 (0)