feat: add abstraction around task
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-12-01 14:25:24 +01:00
parent 974e1ee0d6
commit d6fdda0e4e
4 changed files with 67 additions and 12 deletions

View File

@@ -1,6 +1,9 @@
use std::collections::BTreeMap;
use crate::agent::actions::Plan;
use crate::agent::{
actions::Plan,
task::{ConcreteTask, IntoTask},
};
#[derive(Clone)]
pub struct ScheduledTasks {}
@@ -17,7 +20,12 @@ impl ScheduledTasks {
tracing::info!("scheduling: {}", task);
let plan = Plan::new();
let tasks = plan.tasks().await?;
let tasks: Vec<ConcreteTask> = plan
.tasks()
.await?
.into_iter()
.map(|i| i.into_task())
.collect();
for task in tasks {
if !task.should_run().await? {