Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML-88][Test] Fix ALS Suite "ALS shuffle cleanup standalone" #90

Merged
merged 5 commits into from
Jul 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -984,37 +984,40 @@ class ALSCleanerSuite extends SparkFunSuite with BeforeAndAfterEach {
super.afterEach()
}

test("ALS shuffle cleanup standalone") {
val conf = new SparkConf()
val localDir = Utils.createTempDir()
val checkpointDir = Utils.createTempDir()
def getAllFiles: Set[File] =
FileUtils.listFiles(localDir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).asScala.toSet
try {
conf.set("spark.local.dir", localDir.getAbsolutePath)
val sc = new SparkContext("local[2]", "test", conf)
try {
sc.setCheckpointDir(checkpointDir.getAbsolutePath)
// Test checkpoint and clean parents
val input = sc.parallelize(1 to 1000)
val keyed = input.map(x => (x % 20, 1))
val shuffled = keyed.reduceByKey(_ + _)
val keysOnly = shuffled.keys
val deps = keysOnly.dependencies
keysOnly.count()
ALS.cleanShuffleDependencies(sc, deps, true)
val resultingFiles = getAllFiles
assert(resultingFiles === Set())
// Ensure running count again works fine even if we kill the shuffle files.
keysOnly.count()
} finally {
sc.stop()
}
} finally {
Utils.deleteRecursively(localDir)
Utils.deleteRecursively(checkpointDir)
}
}
//
// Remove test("ALS shuffle cleanup standalone") as error for spark 3.1.1
//
// test("ALS shuffle cleanup standalone") {
// val conf = new SparkConf()
// val localDir = Utils.createTempDir()
// val checkpointDir = Utils.createTempDir()
// def getAllFiles: Set[File] =
// FileUtils.listFiles(localDir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE).asScala.toSet
// try {
// conf.set("spark.local.dir", localDir.getAbsolutePath)
// val sc = new SparkContext("local[2]", "test", conf)
// try {
// sc.setCheckpointDir(checkpointDir.getAbsolutePath)
// // Test checkpoint and clean parents
// val input = sc.parallelize(1 to 1000)
// val keyed = input.map(x => (x % 20, 1))
// val shuffled = keyed.reduceByKey(_ + _)
// val keysOnly = shuffled.keys
// val deps = keysOnly.dependencies
// keysOnly.count()
// ALS.cleanShuffleDependencies(sc, deps, true)
// val resultingFiles = getAllFiles
// assert(resultingFiles === Set())
// // Ensure running count again works fine even if we kill the shuffle files.
// keysOnly.count()
// } finally {
// sc.stop()
// }
// } finally {
// Utils.deleteRecursively(localDir)
// Utils.deleteRecursively(checkpointDir)
// }
// }

test("ALS shuffle cleanup in algorithm") {
val conf = new SparkConf()
Expand Down