Skip to content

Commit

Permalink
Modified SchedulerBackend and TaskScheduler to return System.currentT…
Browse files Browse the repository at this point in the history
…imeMillis as an unique Application Id
  • Loading branch information
sarutak committed Sep 30, 2014
1 parent 1b8b53e commit f6af132
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
13 changes: 0 additions & 13 deletions core/src/main/java/org/apache/spark/ApplicationId.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,4 @@ public String toString() {
return appId;
}


private static ApplicationId defaultAppId =
new ApplicationId(String.valueOf(System.currentTimeMillis()));

/**
* Default implementation of Application Id
*
* @return Default implementation of Application id based on System.currentTimeMillis
*/
public static ApplicationId getApplicationId() {
return defaultAppId;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import org.apache.spark.ApplicationId
* machines become available and can launch tasks on them.
*/
private[spark] trait SchedulerBackend {
private val appId = new ApplicationId(System.currentTimeMillis.toString)

def start(): Unit
def stop(): Unit
def reviveOffers(): Unit
Expand All @@ -41,6 +43,6 @@ private[spark] trait SchedulerBackend {
*
* @return The application ID, if the backend does not provide an ID.
*/
def applicationId() = new ApplicationId(System.currentTimeMillis.toString)
def applicationId() = appId

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import org.apache.spark.storage.BlockManagerId
*/
private[spark] trait TaskScheduler {

private val appId = new ApplicationId(System.currentTimeMillis.toString)

def rootPool: Pool

def schedulingMode: SchedulingMode
Expand Down Expand Up @@ -73,6 +75,6 @@ private[spark] trait TaskScheduler {
*
* @return The application ID, if the backend does not provide an ID.
*/
def applicationId() = new ApplicationId(System.currentTimeMillis.toString)
def applicationId() = appId

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private[spark] class LocalActor(
private[spark] class LocalBackend(scheduler: TaskSchedulerImpl, val totalCores: Int)
extends SchedulerBackend with ExecutorBackend {

private val appId = new ApplicationId("local-" + System.currentTimeMillis)
var localActor: ActorRef = null

override def start() {
Expand Down Expand Up @@ -115,7 +116,7 @@ private[spark] class LocalBackend(scheduler: TaskSchedulerImpl, val totalCores:
localActor ! StatusUpdate(taskId, state, serializedData)
}

override def applicationId =
new ApplicationId("local-" + System.currentTimeMillis)
override def applicationId = appId


}

0 comments on commit f6af132

Please sign in to comment.