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.api.plugin;
0019 
0020 import java.util.Map;
0021 
0022 import org.apache.spark.annotation.DeveloperApi;
0023 
0024 /**
0025  * :: DeveloperApi ::
0026  * Executor component of a {@link SparkPlugin}.
0027  *
0028  * @since 3.0.0
0029  */
0030 @DeveloperApi
0031 public interface ExecutorPlugin {
0032 
0033   /**
0034    * Initialize the executor plugin.
0035    * <p>
0036    * When a Spark plugin provides an executor plugin, this method will be called during the
0037    * initialization of the executor process. It will block executor initialization until it
0038    * returns.
0039    * <p>
0040    * Executor plugins that publish metrics should register all metrics with the context's
0041    * registry ({@link PluginContext#metricRegistry()}) when this method is called. Metrics
0042    * registered afterwards are not guaranteed to show up.
0043    *
0044    * @param ctx Context information for the executor where the plugin is running.
0045    * @param extraConf Extra configuration provided by the driver component during its
0046    *                  initialization.
0047    */
0048   default void init(PluginContext ctx, Map<String, String> extraConf) {}
0049 
0050   /**
0051    * Clean up and terminate this plugin.
0052    * <p>
0053    * This method is called during the executor shutdown phase, and blocks executor shutdown.
0054    */
0055   default void shutdown() {}
0056 
0057 }