48c912e9d6864f6a89e2a88d78a.../src/main.rs
2025-07-31 09:21:57 +00:00

33 lines
900 B
Rust

use fathom_function::tracing;
use pipeline_application::application::Application;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[fathom_function::function]
async fn aggregate_all_comparisons(input: Input) -> Result<Output, String> {
let app = Application::new_from_compile_env(input.org_id, &input.project_id).unwrap();
for pipeline_id in input.pipeline_id {
app.aggregate_all_comparisons(pipeline_id)
.await
.map_err(|err| {
tracing::error!(%pipeline_id, ?err, "Error running the algorithm to aggregate all matched anomalies");
format!("{err:?}")
})?;
}
Ok(Output {
status: "Success".to_owned(),
})
}
#[derive(Debug, Serialize)]
struct Output {
status: String,
}
#[derive(Debug, Deserialize)]
struct Input {
org_id: Uuid,
project_id: String,
pipeline_id: Vec<Uuid>,
}