33 lines
900 B
Rust
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>,
|
|
}
|