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.launcher;
0019 
0020 import java.io.Serializable;
0021 
0022 /**
0023  * Message definitions for the launcher communication protocol. These messages must remain
0024  * backwards-compatible, so that the launcher can talk to older versions of Spark that support
0025  * the protocol.
0026  */
0027 final class LauncherProtocol {
0028 
0029   /** Environment variable where the server port is stored. */
0030   static final String ENV_LAUNCHER_PORT = "_SPARK_LAUNCHER_PORT";
0031 
0032   /** Environment variable where the secret for connecting back to the server is stored. */
0033   static final String ENV_LAUNCHER_SECRET = "_SPARK_LAUNCHER_SECRET";
0034 
0035   /** Spark conf key used to propagate the server port for in-process launches. */
0036   static final String CONF_LAUNCHER_PORT = "spark.launcher.port";
0037 
0038   /** Spark conf key used to propagate the app secret for in-process launches. */
0039   static final String CONF_LAUNCHER_SECRET = "spark.launcher.secret";
0040 
0041   static class Message implements Serializable {
0042 
0043   }
0044 
0045   /**
0046    * Hello message, sent from client to server.
0047    */
0048   static class Hello extends Message {
0049 
0050     final String secret;
0051     final String sparkVersion;
0052 
0053     Hello(String secret, String version) {
0054       this.secret = secret;
0055       this.sparkVersion = version;
0056     }
0057 
0058   }
0059 
0060   /**
0061    * SetAppId message, sent from client to server.
0062    */
0063   static class SetAppId extends Message {
0064 
0065     final String appId;
0066 
0067     SetAppId(String appId) {
0068       this.appId = appId;
0069     }
0070 
0071   }
0072 
0073   /**
0074    * SetState message, sent from client to server.
0075    */
0076   static class SetState extends Message {
0077 
0078     final SparkAppHandle.State state;
0079 
0080     SetState(SparkAppHandle.State state) {
0081       this.state = state;
0082     }
0083 
0084   }
0085 
0086   /**
0087    * Stop message, send from server to client to stop the application.
0088    */
0089   static class Stop extends Message {
0090 
0091   }
0092 
0093 }