You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2019/11/02 06:05:54 UTC

[GitHub] [zeppelin] amakaur edited a comment on issue #3498: [ZEPPELIN-4409] Set spark.app.name to know which user is running which notebook

amakaur edited a comment on issue #3498: [ZEPPELIN-4409] Set spark.app.name to know which user is running which notebook
URL: https://github.com/apache/zeppelin/pull/3498#issuecomment-549014577
 
 
   @zjffdu  here's two ways that i tried: - by either setting SPARK_APP_NAME OR by setting spark property spark.app.name
   
   ``` @Override
     public Map<String, String> buildEnvFromProperties(InterpreterLaunchContext context) throws IOException {
       Map<String, String> env = super.buildEnvFromProperties(context);
       Properties sparkProperties = new Properties();
       String sparkMaster = getSparkMaster(properties);
       for (String key : properties.stringPropertyNames()) {
         if (RemoteInterpreterUtils.isEnvString(key)) {
           env.put(key, properties.getProperty(key));
         }
         if (isSparkConf(key, properties.getProperty(key))) {
           sparkProperties.setProperty(key, toShellFormat(properties.getProperty(key)));
         }
       }
   
       env.put("SPARK_APP_NAME", context.getInterpreterGroupId() + "_testing");
       //sparkProperties.setProperty("spark.app.name", context.getInterpreterGroupId() + "_testing");
   
       setupPropertiesForPySpark(sparkProperties);
       setupPropertiesForSparkR(sparkProperties);
       if (isYarnMode() && getDeployMode().equals("cluster")) {
         env.put("ZEPPELIN_SPARK_YARN_CLUSTER", "true");
         sparkProperties.setProperty("spark.yarn.submit.waitAppCompletion", "false");
       }
   
       StringBuilder sparkConfBuilder = new StringBuilder();
       if (sparkMaster != null) {
         sparkConfBuilder.append(" --master " + sparkMaster);
       }
       if (isYarnMode() && getDeployMode().equals("cluster")) {
         if (sparkProperties.containsKey("spark.files")) {
           sparkProperties.put("spark.files", sparkProperties.getProperty("spark.files") + "," +
               zConf.getConfDir() + "/log4j_yarn_cluster.properties");
         } else {
           sparkProperties.put("spark.files", zConf.getConfDir() + "/log4j_yarn_cluster.properties");
         }
         sparkProperties.put("spark.yarn.maxAppAttempts", "1");
       }```
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services