|
||||
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.io.IOException; 0021 import java.util.Map; 0022 import java.util.Optional; 0023 0024 import org.apache.spark.annotation.Private; 0025 0026 /** 0027 * :: Private :: 0028 * An interface for building shuffle support for Executors. 0029 * 0030 * @since 3.0.0 0031 */ 0032 @Private 0033 public interface ShuffleExecutorComponents { 0034 0035 /** 0036 * Called once per executor to bootstrap this module with state that is specific to 0037 * that executor, specifically the application ID and executor ID. 0038 * 0039 * @param appId The Spark application id 0040 * @param execId The unique identifier of the executor being initialized 0041 * @param extraConfigs Extra configs that were returned by 0042 * {@link ShuffleDriverComponents#initializeApplication()} 0043 */ 0044 void initializeExecutor(String appId, String execId, Map<String, String> extraConfigs); 0045 0046 /** 0047 * Called once per map task to create a writer that will be responsible for persisting all the 0048 * partitioned bytes written by that map task. 0049 * 0050 * @param shuffleId Unique identifier for the shuffle the map task is a part of 0051 * @param mapTaskId An ID of the map task. The ID is unique within this Spark application. 0052 * @param numPartitions The number of partitions that will be written by the map task. Some of 0053 * these partitions may be empty. 0054 */ 0055 ShuffleMapOutputWriter createMapOutputWriter( 0056 int shuffleId, 0057 long mapTaskId, 0058 int numPartitions) throws IOException; 0059 0060 /** 0061 * An optional extension for creating a map output writer that can optimize the transfer of a 0062 * single partition file, as the entire result of a map task, to the backing store. 0063 * <p> 0064 * Most implementations should return the default {@link Optional#empty()} to indicate that 0065 * they do not support this optimization. This primarily is for backwards-compatibility in 0066 * preserving an optimization in the local disk shuffle storage implementation. 0067 * 0068 * @param shuffleId Unique identifier for the shuffle the map task is a part of 0069 * @param mapId An ID of the map task. The ID is unique within this Spark application. 0070 */ 0071 default Optional<SingleSpillShuffleMapOutputWriter> createSingleFileMapOutputWriter( 0072 int shuffleId, 0073 long mapId) throws IOException { 0074 return Optional.empty(); 0075 } 0076 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |