From 538a50b2959a2a831642bb30333a93274c381cb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABl=20Madon?= <mael.madon@irit.fr>
Date: Mon, 10 Jul 2023 10:53:09 +0200
Subject: [PATCH] fix: easy-bf-fast not updating the expected earliest start
 time of priority job. Fixes #9

---
 src/algo/easy_bf_fast.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/algo/easy_bf_fast.cpp b/src/algo/easy_bf_fast.cpp
index e475849..e0cf862 100644
--- a/src/algo/easy_bf_fast.cpp
+++ b/src/algo/easy_bf_fast.cpp
@@ -3,6 +3,7 @@
 //#include <loguru.hpp>
 
 #include "../pempek_assert.hpp"
+#include <cstddef>
 
 EasyBackfillingFast::EasyBackfillingFast(Workload *workload,
     SchedulingDecision *decision, Queue *queue, ResourceSelector *selector,
@@ -133,6 +134,11 @@ void EasyBackfillingFast::make_decisions(double date,
             // Backfill jobs that does not hinder priority job.
             if (_nb_available_machines > 0)
             {
+                // Update priority job expected starting time (might have changed if a recently ended job 
+                // completed before its walltime)
+                if (_priority_job != nullptr)
+                    _priority_job->completion_time = compute_priority_job_expected_earliest_starting_time();
+
                 for (auto job_it = _pending_jobs.begin();
                      job_it != _pending_jobs.end(); )
                 {
-- 
GitLab