Github user pwendell commented on a diff in the pull request:
https://github.com/apache/spark/pull/1486#discussion_r17525861
--- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskLocation.scala
---
@@ -23,12 +23,33 @@ package org.apache.spark.scheduler
* of preference will be executors on the same host if this is not
possible.
*/
private[spark]
-class TaskLocation private (val host: String, val executorId:
Option[String]) extends Serializable {
- override def toString: String = "TaskLocation(" + host + ", " +
executorId + ")"
+sealed abstract class TaskLocation(val host: String) {
+}
+
+case class ExecutorCacheTaskLocation(override val host: String, val
executorId: String)
+ extends TaskLocation(host) {
+}
+
+case class HDFSCachedTaskLocation(override val host: String) extends
TaskLocation(host) {
+ override def toString = TaskLocation.IN_MEMORY_LOCATION_TAG + host
+}
+
+case class HostTaskLocation(override val host: String) extends
TaskLocation(host) {
+ override def toString = host
}
private[spark] object TaskLocation {
- def apply(host: String, executorId: String) = new TaskLocation(host,
Some(executorId))
+ val IN_MEMORY_LOCATION_TAG = "_M_"
+
+ def apply(host: String, executorId: String) = new
ExecutorCacheTaskLocation(host, executorId)
+
+ def apply(host: String) = new HostTaskLocation(host)
- def apply(host: String) = new TaskLocation(host, None)
+ def fromString(str : String) = {
--- End diff --
Instead of having a separate `fromString` - can you just make the normal
`apply()` pattern mach on this (see `BlockId.scala` again for inspiration)? It
is a bit awkward to have this separate `apply` in the case where you have an
executor ID... longer term we should probably refactor that so it has a string
tag similar and operates in the same way as HDFS cached task location.
---
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]