Skip to content

Commit 459f2b5

Browse files
committed
[hyper] hyper is dead! long live hyper!
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: 325394991 @exported-using-ghexport Differential Revision: [D87370648](https://our.internmc.facebook.com/intern/diff/D87370648/)
1 parent c7dae4c commit 459f2b5

File tree

18 files changed

+143
-3084
lines changed

18 files changed

+143
-3084
lines changed

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 & 253 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)