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

Function notify_host

guest-agent/src/guest_api_service.rs:208–222  ·  view source on GitHub ↗
(event: &str, payload: &str)

Source from the content-addressed store, hash-verified

206}
207
208pub async fn notify_host(event: &str, payload: &str) -> Result<()> {
209 let local_config: SysConfig = serde_json::from_str(&fs::read_to_string(format!(
210 "{HOST_SHARED_DIR}/{SYS_CONFIG}"
211 ))?)?;
212 let Some(host_api_url) = local_config.host_api_url else {
213 anyhow::bail!("host_api_url not configured");
214 };
215 let nc = host_api::client::new_client(host_api_url);
216 nc.notify(Notification {
217 event: event.to_string(),
218 payload: payload.to_string(),
219 })
220 .await?;
221 Ok(())
222}
223
224fn perr<T, E: Debug>(result: Result<T, E>) {
225 if let Err(e) = &result {

Callers 1

shutdownMethod · 0.85

Calls 2

new_clientFunction · 0.50
notifyMethod · 0.45

Tested by

no test coverage detected