hydra-evaluator: make the logic of the scheduler easier to read

[?]
Mar 3, 2020, 11:17 PM
K6CGDFOTL2YODZPNT36RKQ3JW435323R52LLNWW4XELWR4JRDH3AC

Dependencies

  • [2] W4G5MZZS hydra-evaluator improvements
  • [3] 4YCF3KBG Concurrent hydra-evaluator

Change contents

  • edit in src/hydra-evaluator/hydra-evaluator.cc at line 132
    [3.3759]
    [3.3759]
    bool shouldEvaluate(Jobset & jobset)
    {
    if (jobset.pid != -1) {
    // Already running.
    return false;
    }
    if (jobset.triggerTime == std::numeric_limits<time_t>::max()) {
    // An evaluation of this Jobset is requested
    return true;
    }
    if (jobset.checkInterval <= 0) {
    // Automatic scheduling is disabled. We allow requested
    // evaluations, but never schedule start one.
    return false;
    }
    if (jobset.lastCheckedTime + jobset.checkInterval <= time(0)) {
    // Time to schedule a fresh evaluation
    return true;
    }
    return false;
    }
  • edit in src/hydra-evaluator/hydra-evaluator.cc at line 162
    [3.3847][3.3847:3878]()
    time_t now = time(0);
  • replacement in src/hydra-evaluator/hydra-evaluator.cc at line 167
    [2.1016][2.1016:1253]()
    (i->second.pid == -1 &&
    (i->second.triggerTime != std::numeric_limits<time_t>::max() ||
    (i->second.checkInterval > 0 && i->second.lastCheckedTime + i->second.checkInterval <= now))))
    [2.1016]
    [3.4295]
    (i->second.evaluation_style && shouldEvaluate(i->second)))