From e0e644f11908941c4654004702edc0712d6b6e07 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Tue, 14 Jan 2025 13:10:11 +0100 Subject: [PATCH] fix #6069: prune simulator: allow values specifying both range and step size The prune schedule simulator returned "X/Y is not an integer" error for a schedule that uses a `start..end` hour range combined with a `/`-separated time step-gap, while that works out fine for actual prune jobs in PBS. Previously, a schedule like `5..23/3` was mistakenly interpreted as hour-start = `5`, hour-end = `23/3`, hour-step = `1`, resulting in above parser error for hour-end. By splitting the right hand side on `/` to extract the step and normalizing that we correctly get hour-start = `5`, hour-end = `23`, hour-step = `3`. Short reminder: hours and minutes part are treated as separate and can both be declared as range, step or range-step, so `5..23/3:15` does not mean the step size is 3:15 (i.e. 3.25 hours or 195 minutes) but rather 3 hours step size and each resulting interval happens on the 15 minute of that hour. Signed-off-by: Fiona Ebner [TL: add context to commit message partially copied from bug report and add a short reminder how these intervals work, can be confusing] Signed-off-by: Thomas Lamprecht --- docs/prune-simulator/prune-simulator_source.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/prune-simulator/prune-simulator_source.js b/docs/prune-simulator/prune-simulator_source.js index 0fb779e6..8b793c55 100644 --- a/docs/prune-simulator/prune-simulator_source.js +++ b/docs/prune-simulator/prune-simulator_source.js @@ -354,12 +354,17 @@ Ext.onReady(function() { specValues.forEach(function(value) { if (value.includes('..')) { let [start, end] = value.split('..'); + let step = 1; + if (end.includes('/')) { + [end, step] = end.split('/'); + step = assertValid(step); + } start = assertValid(start); end = assertValid(end); if (start > end) { throw "interval start is bigger then interval end '" + start + " > " + end + "'"; } - for (let i = start; i <= end; i++) { + for (let i = start; i <= end; i += step) { matches[i] = 1; } } else if (value.includes('/')) {