Skip to content

Commit 06bf223

Browse files
committed
Merge branch 'spark-2.0-preview'
2 parents 2aa4e35 + 970ea9e commit 06bf223

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

job-server/src/main/scala/spark/jobserver/BinaryManager.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ case object InvalidBinary
3333
case object BinaryStored
3434
case object BinaryDeleted
3535
case class BinaryStorageFailure(ex: Throwable)
36+
case class BinaryDeletionFailure(ex: Throwable)
3637

3738
/**
3839
* An Actor that manages the jars stored by the job server. It's important that threads do not try to
@@ -106,6 +107,9 @@ class BinaryManager(jobDao: ActorRef) extends InstrumentedActor {
106107

107108
case DeleteBinary(appName) =>
108109
logger.info(s"Deleting binary $appName")
109-
deleteBinary(appName).pipeTo(sender)
110+
deleteBinary(appName).map {
111+
case Success(_) => BinaryDeleted
112+
case Failure(ex) => BinaryDeletionFailure(ex)
113+
}.pipeTo(sender)
110114
}
111115
}

job-server/src/main/scala/spark/jobserver/io/FileCacher.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ trait FileCacher {
5252
if (name.startsWith(prefix)) {
5353
val suffix = name.substring(prefix.length)
5454
(Pattern findFirstIn suffix).isDefined
55+
} else {
56+
false
5557
}
56-
false
5758
}
5859
})
5960
if (binaries != null) {

job-server/src/test/scala/spark/jobserver/BinaryManagerSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class BinaryManagerSpec extends TestKit(BinaryManagerSpec.system) with ImplicitS
6868

6969
it("should respond when deleted successfully") {
7070
binaryManager ! DeleteBinary("valid")
71-
expectMsg(Success({}))
71+
expectMsg(BinaryDeleted)
7272
}
7373
}
7474
}

job-server/src/test/scala/spark/jobserver/io/FileCacherSpec.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class FileCacherSpec extends FileCacher with FunSpecLike with Matchers {
1616
}
1717

1818
it("clean cache binaries") {
19-
cleanCacheBinaries("job")
19+
val f = File.createTempFile("jobTest-20161010_010000_000.jar", ".jar", new File(rootDir))
20+
cleanCacheBinaries("jobTest")
21+
f.exists() should be(false)
2022
}
2123
}

0 commit comments

Comments
 (0)