Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *    http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 package org.apache.spark.shuffle.api;
0019 
0020 import java.util.Map;
0021 
0022 import org.apache.spark.annotation.Private;
0023 
0024 /**
0025  * :: Private ::
0026  * An interface for building shuffle support modules for the Driver.
0027  */
0028 @Private
0029 public interface ShuffleDriverComponents {
0030 
0031   /**
0032    * Called once in the driver to bootstrap this module that is specific to this application.
0033    * This method is called before submitting executor requests to the cluster manager.
0034    *
0035    * This method should prepare the module with its shuffle components i.e. registering against
0036    * an external file servers or shuffle services, or creating tables in a shuffle
0037    * storage data database.
0038    *
0039    * @return additional SparkConf settings necessary for initializing the executor components.
0040    * This would include configurations that cannot be statically set on the application, like
0041    * the host:port of external services for shuffle storage.
0042    */
0043   Map<String, String> initializeApplication();
0044 
0045   /**
0046    * Called once at the end of the Spark application to clean up any existing shuffle state.
0047    */
0048   void cleanupApplication();
0049 
0050   /**
0051    * Called once per shuffle id when the shuffle id is first generated for a shuffle stage.
0052    *
0053    * @param shuffleId The unique identifier for the shuffle stage.
0054    */
0055   default void registerShuffle(int shuffleId) {}
0056 
0057   /**
0058    * Removes shuffle data associated with the given shuffle.
0059    *
0060    * @param shuffleId The unique identifier for the shuffle stage.
0061    * @param blocking Whether this call should block on the deletion of the data.
0062    */
0063   default void removeShuffle(int shuffleId, boolean blocking) {}
0064 }