Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/5236#discussion_r28001133
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
@@ -848,14 +848,14 @@ private[spark] class TaskSetManager(
}
private def getLocalityWait(level: TaskLocality.TaskLocality): Long = {
- val defaultWait = conf.get("spark.locality.wait", "3000")
+ val defaultWait = conf.get("spark.locality.wait", "3s")
level match {
case TaskLocality.PROCESS_LOCAL =>
- conf.get("spark.locality.wait.process", defaultWait).toLong
+ Utils.timeStringAsMs(conf.get("spark.locality.wait.process",
defaultWait))
case TaskLocality.NODE_LOCAL =>
- conf.get("spark.locality.wait.node", defaultWait).toLong
+ Utils.timeStringAsMs(conf.get("spark.locality.wait.node",
defaultWait))
case TaskLocality.RACK_LOCAL =>
- conf.get("spark.locality.wait.rack", defaultWait).toLong
+ Utils.timeStringAsMs(conf.get("spark.locality.wait.rack",
defaultWait))
case _ => 0L
}
--- End diff --
just an idea, maybe we can rewrite this as:
```
val defaultWait = conf.get("spark.locality.wait", "3s")
val localityWaitKey =
key match {
case TaskLocality.PROCESS_LOCAL => "spark.locality.wait.process"
case TaskLocality.NODE_LOCAL => "spark.locality.wait.node"
case TaskLocality.RACK_LOCAL => "spark.locality.wait.rack"
}
Utils.timeStringAsMs(conf.get(localityWaitKey, defaultWait)
```
Looks nicer IMO
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]