Skip to content

Commit 16a0d27

Browse files
committed
Cleanup
1 parent e4df3e7 commit 16a0d27

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

core/src/test/scala/org/apache/spark/ExternalShuffleServiceSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ExternalShuffleServiceSuite extends ShuffleSuite with BeforeAndAfterAll {
6565

6666
// Invalidate the registered executors, disallowing access to their shuffle blocks (without
6767
// deleting the actual shuffle files, so we could access them without the shuffle service).
68-
rpcHandler.removeApplication(sc.conf.getAppId, false /* cleanupLocalDirs */)
68+
rpcHandler.applicationRemoved(sc.conf.getAppId, false /* cleanupLocalDirs */)
6969

7070
// Now Spark will receive FetchFailed, and not retry the stage due to "spark.test.noStageRetry"
7171
// being set.

network/shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public StreamManager getStreamManager() {
9898
* Removes an application (once it has been terminated), and optionally will clean up any
9999
* local directories associated with the executors of that application in a separate thread.
100100
*/
101-
public void removeApplication(String appId, boolean cleanupLocalDirs) {
102-
blockManager.removeApplication(appId, cleanupLocalDirs);
101+
public void applicationRemoved(String appId, boolean cleanupLocalDirs) {
102+
blockManager.applicationRemoved(appId, cleanupLocalDirs);
103103
}
104104
}

network/shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockManager.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public ManagedBuffer getBlockData(String appId, String execId, String blockId) {
118118
* It is not valid to call registerExecutor() for an executor with this appId after invoking
119119
* this method.
120120
*/
121-
public void removeApplication(String appId, boolean cleanupLocalDirs) {
121+
public void applicationRemoved(String appId, boolean cleanupLocalDirs) {
122122
logger.info("Application {} removed, cleanupLocalDirs = {}", appId, cleanupLocalDirs);
123123
Iterator<Map.Entry<AppExecId, ExecutorShuffleInfo>> it = executors.entrySet().iterator();
124124
while (it.hasNext()) {
@@ -131,12 +131,11 @@ public void removeApplication(String appId, boolean cleanupLocalDirs) {
131131
it.remove();
132132

133133
if (cleanupLocalDirs) {
134-
logger.debug("Cleaning up executor {}'s {} local dirs", fullId, executor.localDirs.length);
134+
logger.info("Cleaning up executor {}'s {} local dirs", fullId, executor.localDirs.length);
135135

136136
// Execute the actual deletion in a different thread, as it may take some time.
137137
directoryCleanupExecutor.execute(new Runnable() {
138-
@Override
139-
public void run() {
138+
@Override public void run() {
140139
deleteExecutorDirs(executor.localDirs);
141140
}
142141
});
@@ -153,7 +152,7 @@ private void deleteExecutorDirs(String[] dirs) {
153152
for (String localDir : dirs) {
154153
try {
155154
JavaUtils.deleteRecursively(new File(localDir));
156-
logger.info("Successfully cleaned up directory: " + localDir);
155+
logger.debug("Successfully cleaned up directory: " + localDir);
157156
} catch (Exception e) {
158157
logger.error("Failed to delete directory: " + localDir, e);
159158
}

network/shuffle/src/test/java/org/apache/spark/network/shuffle/ExternalShuffleCleanupSuite.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030

3131
public class ExternalShuffleCleanupSuite {
3232

33-
// Executor used to ensure cleanup happens synchronously in this thread.
33+
// Same-thread Executor used to ensure cleanup happens synchronously in test thread.
3434
Executor sameThreadExecutor = MoreExecutors.sameThreadExecutor();
3535

3636
@Test
37-
public void cleanupDirs() throws IOException {
37+
public void noCleanupAndCleanup() throws IOException {
3838
TestShuffleDataContext dataContext = createSomeData();
3939

4040
ExternalShuffleBlockManager manager = new ExternalShuffleBlockManager(sameThreadExecutor);
4141
manager.registerExecutor("app", "exec0", dataContext.createExecutorInfo("shuffleMgr"));
42-
manager.removeApplication("app", false /* cleanup */);
42+
manager.applicationRemoved("app", false /* cleanup */);
4343

4444
assertStillThere(dataContext);
4545

4646
manager.registerExecutor("app", "exec1", dataContext.createExecutorInfo("shuffleMgr"));
47-
manager.removeApplication("app", true /* cleanup */);
47+
manager.applicationRemoved("app", true /* cleanup */);
4848

4949
assertCleanedUp(dataContext);
5050
}
@@ -61,7 +61,7 @@ public void cleanupUsesExecutor() throws IOException {
6161
ExternalShuffleBlockManager manager = new ExternalShuffleBlockManager(noThreadExecutor);
6262

6363
manager.registerExecutor("app", "exec0", dataContext.createExecutorInfo("shuffleMgr"));
64-
manager.removeApplication("app", true /* cleanup */);
64+
manager.applicationRemoved("app", true);
6565

6666
assertStillThere(dataContext);
6767

@@ -70,15 +70,15 @@ public void cleanupUsesExecutor() throws IOException {
7070
}
7171

7272
@Test
73-
public void cleanupMultipleExecutrs() throws IOException {
73+
public void cleanupMultipleExecutors() throws IOException {
7474
TestShuffleDataContext dataContext0 = createSomeData();
7575
TestShuffleDataContext dataContext1 = createSomeData();
7676

7777
ExternalShuffleBlockManager manager = new ExternalShuffleBlockManager(sameThreadExecutor);
7878

7979
manager.registerExecutor("app", "exec0", dataContext0.createExecutorInfo("shuffleMgr"));
8080
manager.registerExecutor("app", "exec1", dataContext1.createExecutorInfo("shuffleMgr"));
81-
manager.removeApplication("app", true /* cleanup */);
81+
manager.applicationRemoved("app", true);
8282

8383
assertCleanedUp(dataContext0);
8484
assertCleanedUp(dataContext1);
@@ -94,20 +94,20 @@ public void cleanupOnlyRemovedApp() throws IOException {
9494
manager.registerExecutor("app-0", "exec0", dataContext0.createExecutorInfo("shuffleMgr"));
9595
manager.registerExecutor("app-1", "exec0", dataContext1.createExecutorInfo("shuffleMgr"));
9696

97-
manager.removeApplication("app-nonexistent", true /* cleanup */);
97+
manager.applicationRemoved("app-nonexistent", true);
9898
assertStillThere(dataContext0);
9999
assertStillThere(dataContext1);
100100

101-
manager.removeApplication("app-0", true /* cleanup */);
101+
manager.applicationRemoved("app-0", true);
102102
assertCleanedUp(dataContext0);
103103
assertStillThere(dataContext1);
104104

105-
manager.removeApplication("app-1", true /* cleanup */);
105+
manager.applicationRemoved("app-1", true);
106106
assertCleanedUp(dataContext0);
107107
assertCleanedUp(dataContext1);
108108

109109
// Make sure it's not an error to cleanup multiple times
110-
manager.removeApplication("app-1", true /* cleanup */);
110+
manager.applicationRemoved("app-1", true);
111111
assertCleanedUp(dataContext0);
112112
assertCleanedUp(dataContext1);
113113
}

network/shuffle/src/test/java/org/apache/spark/network/shuffle/ExternalShuffleIntegrationSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static void afterAll() {
105105

106106
@After
107107
public void afterEach() {
108-
handler.removeApplication(APP_ID, false /* cleanupLocalDirs */);
108+
handler.applicationRemoved(APP_ID, false /* cleanupLocalDirs */);
109109
}
110110

111111
class FetchResult {

0 commit comments

Comments
 (0)