daemon: add run-agent RPC for queuing agent jobs
Adds `poc-memory daemon run-agent <type> <count>` CLI command that sends an RPC to the daemon to queue agent runs, instead of spawning separate processes. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
a505b9384e
commit
7d6ebbacab
2 changed files with 16 additions and 0 deletions
|
|
@ -1277,6 +1277,17 @@ pub fn rpc_consolidate() -> Result<(), String> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn rpc_run_agent(agent: &str, count: usize) -> Result<(), String> {
|
||||
let cmd = format!("run-agent {} {}", agent, count);
|
||||
match send_rpc(&cmd) {
|
||||
Some(resp) => {
|
||||
println!("{}", resp.trim());
|
||||
Ok(())
|
||||
}
|
||||
None => Err("Daemon not running.".into()),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_status_socket() -> Option<DaemonStatus> {
|
||||
use std::io::Read as _;
|
||||
use std::os::unix::net::UnixStream;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue