Skip to content

Commit 13122e1

Browse files
committed
When computing SEQUENCEANALYSIS_MAX_RAM, reduce this value by the amount reserved for the pipeline java process
1 parent 524fccc commit 13122e1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.List;
3232
import java.util.Map;
3333
import java.util.Set;
34+
import java.util.stream.Collectors;
3435

3536
/**
3637
* Created by bimber on 5/25/2017.
@@ -481,6 +482,23 @@ private File createSubmitScript(PipelineJob job) throws PipelineJobException
481482

482483
if (ram != null)
483484
{
485+
// Adjust based on the java process -Xmx:
486+
List<String> javaOpts = getConfig().getFinalJavaOpts(job, this);
487+
if (javaOpts != null)
488+
{
489+
List<Integer> javaOptXms = javaOpts.stream().filter(x -> x.startsWith("-Xmx")).map(x -> x.replaceAll("-Xmx", "").replaceAll("g", "")).map(x -> Integer.parseInt(x)).collect(Collectors.toList());
490+
if (!javaOptXms.isEmpty())
491+
{
492+
if (javaOptXms.size() > 1)
493+
{
494+
job.getLogger().error("More than one java -Xmx found: " + StringUtils.join(javaOpts, " "));
495+
}
496+
497+
job.getLogger().debug("Adjusting request RAM based on java process -Xmx from " + ram + ", reducing by : " + javaOptXms.get(0));
498+
ram = ram - javaOptXms.get(0);
499+
}
500+
}
501+
484502
environment.add("SEQUENCEANALYSIS_MAX_RAM=" + ram);
485503
}
486504

0 commit comments

Comments
 (0)