Skip to content

Commit b8297b0

Browse files
committed
Error handling for non-numeric MaxRSS values from slurm
1 parent 204cbaf commit b8297b0

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

cluster/src/org/labkey/cluster/pipeline/SlurmExecutionEngine.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.labkey.cluster.pipeline;
22

33
import org.apache.commons.lang3.StringUtils;
4+
import org.apache.commons.lang3.math.NumberUtils;
45
import org.apache.logging.log4j.LogManager;
56
import org.apache.logging.log4j.Logger;
67
import org.jetbrains.annotations.NotNull;
@@ -282,11 +283,21 @@ else if (headerFound)
282283
// NOTE: if the line has blank ending columns, trimmed lines might lack that value
283284
if (maxRssIdx > -1 && maxRssIdx < tokens.length)
284285
{
285-
long bytes = FileSizeFormatter.convertStringRepresentationToBytes(tokens[maxRssIdx]);
286-
long requestInBytes = FileSizeFormatter.convertStringRepresentationToBytes(getConfig().getRequestMemory() + "G"); //request is always GB
287-
if (bytes > requestInBytes)
286+
try
288287
{
289-
info = "Job exceeded memory, max was: " + FileSizeFormatter.convertBytesToUnit(bytes, 'G') + "G";
288+
if (NumberUtils.isCreatable(tokens[maxRssIdx]))
289+
{
290+
long bytes = FileSizeFormatter.convertStringRepresentationToBytes(tokens[maxRssIdx]);
291+
long requestInBytes = FileSizeFormatter.convertStringRepresentationToBytes(getConfig().getRequestMemory() + "G"); //request is always GB
292+
if (bytes > requestInBytes)
293+
{
294+
info = "Job exceeded memory, max was: " + FileSizeFormatter.convertBytesToUnit(bytes, 'G') + "G";
295+
}
296+
}
297+
}
298+
catch (IllegalArgumentException e)
299+
{
300+
_log.error("Unable to parse MaxRSS for job: " + job.getClusterId() + ", with line: [" + line + "]", e);
290301
}
291302
}
292303
}

0 commit comments

Comments
 (0)