blob: dfe3c5a85bc25f47a85a0da31a4649b27ef2c3be (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package spark.scheduler.cluster
/**
* Information about a running task attempt inside a TaskSet.
*/
private[spark]
class TaskInfo(
val taskId: Long,
val index: Int,
val launchTime: Long,
val executorId: String,
val host: String,
val preferred: Boolean) {
var finishTime: Long = 0
var failed = false
def markSuccessful(time: Long = System.currentTimeMillis) {
finishTime = time
}
def markFailed(time: Long = System.currentTimeMillis) {
finishTime = time
failed = true
}
def finished: Boolean = finishTime != 0
def successful: Boolean = finished && !failed
def running: Boolean = !finished
def duration: Long = {
if (!finished) {
throw new UnsupportedOperationException("duration() called on unfinished tasks")
} else {
finishTime - launchTime
}
}
def timeRunning(currentTime: Long): Long = currentTime - launchTime
}
|