|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
use std::sync::Arc; |
|
|
|
|
|
|
|
|
|
use super::analytic_unit::types::{AnalyticUnitConfig, PatternConfig}; |
|
|
|
|
use super::analytic_unit::types::{AnalyticUnitConfig, PatternConfig, PatchConfig}; |
|
|
|
|
use super::types::{self, DetectionRunnerConfig, LearningTrain}; |
|
|
|
|
use super::{ |
|
|
|
|
analytic_client::AnalyticClient, |
|
|
|
@ -19,10 +19,13 @@ use crate::services::analytic_service::analytic_unit::types::{AnalyticUnit, Lear
|
|
|
|
|
|
|
|
|
|
use anyhow; |
|
|
|
|
|
|
|
|
|
use serde_json::Value; |
|
|
|
|
use tokio::sync::{mpsc, oneshot, RwLock}; |
|
|
|
|
|
|
|
|
|
use chrono::Utc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: now it's basically single analytic unit, service will operate on many AU
|
|
|
|
|
pub struct AnalyticService { |
|
|
|
|
metric_service: MetricService, |
|
|
|
@ -172,6 +175,7 @@ impl AnalyticService {
|
|
|
|
|
RequestType::PatchConfig(patch_obj, tx) => { |
|
|
|
|
// TODO: path config
|
|
|
|
|
// TODO: run learning if config type changed
|
|
|
|
|
self.patch_config(patch_obj); |
|
|
|
|
tx.send(()).unwrap(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -215,6 +219,11 @@ impl AnalyticService {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn patch_config(&mut self, mut patch: PatchConfig) { |
|
|
|
|
// let r = patch.take();
|
|
|
|
|
println!("{:?}", patch); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pub async fn serve(&mut self) { |
|
|
|
|
// TODO: remove this hack
|
|
|
|
|
self.consume_request(RequestType::RunLearning); |
|
|
|
|