sunchao commented on code in PR #57332:
URL: https://github.com/apache/spark/pull/57332#discussion_r3619162551


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala:
##########
@@ -168,7 +168,11 @@ private[spark] class BasicExecutorFeatureStep(
           ENV_DRIVER_URL -> driverUrl,
           ENV_EXECUTOR_CORES -> {
             if 
(kubernetesConf.get(KUBERNETES_ALLOCATION_RECOVERY_MODE_ENABLED).getOrElse(false))
 {
-              kubernetesConf.get("spark.task.cpus", "1")
+              // `spark.task.cpus` may be fractional, so round up to an 
integer (at least 1).
+              // When it is 0.5 or less, the single announced core fits more 
than one task and
+              // the single-task-per-recovery-executor guarantee no longer 
holds;
+              // ExecutorPodsAllocator logs a warning for that case.
+              math.max(1, kubernetesConf.get("spark.task.cpus", 
"1.0").toDouble.ceil.toInt).toString

Review Comment:
   [P2] Task-only profiles can still make recovery executors unusable
   
   With dynamic allocation disabled, `TaskResourceProfile` tasks are explicitly 
schedulable on default-profile executors, so the profile passed here does not 
necessarily describe the active task set. For example, with global 
`spark.task.cpus=1`, four executor cores, and a task-only stage profile 
requesting `1.5`, a normal executor has two slots, but its recovery replacement 
announces one core and cannot run any remaining stage task. The inverse 
mismatch can over-admit tasks without the new per-profile warning. Please 
account for compatible task-only profiles rather than assuming the launched 
executor profile identifies every task profile it can run.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to