Adding ForceUp message

This commit is contained in:
Kinesin Data Technologies Incorporated
2022-10-06 14:52:54 -03:00
parent 03412bb79d
commit 5d4ff2bb8b
+15 -4
View File
@@ -39,13 +39,11 @@ pub enum RunnerMessage {
RetryAction { RetryAction {
action_id: usize, action_id: usize,
}, },
/*
/// Marks all resources in the set available over the interval /// Marks all resources in the set available over the interval
ForceUp { ForceUp {
resources: HashSet<String>, resources: HashSet<String>,
interval: Interval, interval: Interval,
}, },
*/
/// Marks all resources in the set as down over _at least_ the interval. /// Marks all resources in the set as down over _at least_ the interval.
/// Will cause a re-check / re-gen /// Will cause a re-check / re-gen
ForceDown { ForceDown {
@@ -342,13 +340,26 @@ impl Runner {
self.events self.events
.push(delayed_event(Duration::seconds(5), RunnerMessage::Tick)); .push(delayed_event(Duration::seconds(5), RunnerMessage::Tick));
} }
/*
Some(Ok(RunnerMessage::ForceUp { Some(Ok(RunnerMessage::ForceUp {
resources, resources,
interval, interval,
})) => { })) => {
for (tid, task) in self.tasks.iter().enumerate() {
if task.provides.is_subset(&resources) {
let aligned_is =
IntervalSet::from(task.schedule.align_interval(interval));
for resource in &task.provides {
self.current.get_mut(resource).unwrap().merge(&aligned_is);
}
for action in &mut self.actions {
if action.task == tid && aligned_is.has_subset(action.interval) {
action.state = ActionState::Completed;
}
}
}
}
self.store_state();
} }
*/
Some(Ok(RunnerMessage::ForceDown { Some(Ok(RunnerMessage::ForceDown {
resources, resources,
interval, interval,