From 5eb67cd24b026aaf05f4dd586230a2175b2d4101 Mon Sep 17 00:00:00 2001 From: Eric Trautman Date: Sat, 9 Sep 2023 21:31:27 -0400 Subject: [PATCH] make spark.task.cpus check more robust so that it doesn't crash local tests --- .../spark/intensityadjust/IntensityCorrectionClient.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/render-ws-spark-client/src/main/java/org/janelia/render/client/spark/intensityadjust/IntensityCorrectionClient.java b/render-ws-spark-client/src/main/java/org/janelia/render/client/spark/intensityadjust/IntensityCorrectionClient.java index c16848424..4b367778a 100644 --- a/render-ws-spark-client/src/main/java/org/janelia/render/client/spark/intensityadjust/IntensityCorrectionClient.java +++ b/render-ws-spark-client/src/main/java/org/janelia/render/client/spark/intensityadjust/IntensityCorrectionClient.java @@ -78,7 +78,13 @@ public void runWithContext(final JavaSparkContext sparkContext) // allow multithread tasks but warn if Spark isn't configured properly to support them final int threadsForSparkTasks = cmdLineSetup.distributedSolve.threadsWorker; - final String taskCpusString = sparkContext.getConf().get("spark.task.cpus"); + String taskCpusString = null; + try { + final SparkConf sparkConf = sparkContext.getConf(); + taskCpusString = sparkConf.get("spark.task.cpus"); + } catch (final Exception e) { + LOG.warn("ignoring failure to retrieve spark.task.cpus value", e); + } if (taskCpusString != null) { final int taskCpus = Integer.parseInt(taskCpusString); if (taskCpus != threadsForSparkTasks) {