attilapiros commented on a change in pull request #24499: [SPARK-27677][Core] 
Serve local disk persisted blocks by the external service after releasing 
executor by dynamic allocation
URL: https://github.com/apache/spark/pull/24499#discussion_r285774651
 
 

 ##########
 File path: 
common/network-shuffle/src/test/java/org/apache/spark/network/shuffle/CleanupNonShuffleServiceServedFilesSuite.java
 ##########
 @@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.network.shuffle;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.*;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.MoreExecutors;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.spark.network.util.MapConfigProvider;
+import org.apache.spark.network.util.TransportConf;
+
+public class CleanupNonShuffleServiceServedFilesSuite {
+
+  // Same-thread Executor used to ensure cleanup happens synchronously in test 
thread.
+  private Executor sameThreadExecutor = MoreExecutors.sameThreadExecutor();
+
+  private static final String SORT_MANAGER = 
"org.apache.spark.shuffle.sort.SortShuffleManager";
+
+  private static Set<String> expectedShuffleFilesToKeep =
+    ImmutableSet.of("shuffle_782_450_0.index", "shuffle_782_450_0.data");
+
+  private static Set<String> expectedShuffleAndRddFilesToKeep =
+    ImmutableSet.of("shuffle_782_450_0.index", "shuffle_782_450_0.data", 
"rdd_12_34");
+
+  private TransportConf getConf(boolean isFetchRddEnabled) {
+    return new TransportConf(
+      "shuffle",
+      new MapConfigProvider(ImmutableMap.of(
+        "spark.shuffle.service.fetch.rdd.enabled",
 
 Review comment:
   What about creating a new class `Constant` in that package? 
   
   Should I only add `spark.shuffle.service.fetch.rdd.enabled` or check within 
this PR for other possible constants to extract? I am happy to help and for me 
extracting constants seams to me a low risk refactoring but I would like to 
avoid making the reviewer's life harder. What is preference here? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to