From 41fadcb10e218a8fec8342e8be7a3a7bbbfe4510 Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Wed, 11 Mar 2020 17:59:13 +0000
Subject: [PATCH] Don't attempt to repartition when restarting, we don't have
 any task times until the first real step runs

---
 src/engine.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 8de7adea99..d3cd4b08c5 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -262,9 +262,10 @@ void engine_repartition_trigger(struct engine *e) {
 
   /* Do nothing if there have not been enough steps since the last repartition
    * as we don't want to repeat this too often or immediately after a
-   * repartition step. We attempt all this even when we are not repartitioning
-   * as the balance logs can still be interesting. */
-  if (e->step - e->last_repartition >= 2) {
+   * repartition step, or also immediately on restart. We check all this
+   * even when we are not repartitioning as the balance logs can still be
+   * interesting. */
+  if (e->step - e->last_repartition >= 2 && !e->restarting) {
 
     /* If we have fixed costs available and this is step 2 or we are forcing
      * repartitioning then we do a forced fixed costs repartition regardless. */
-- 
GitLab