amakaur commented 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-549220516
 
 
   @zjffdu Thanks for trying it out. Also, let me try again, but i had 
spark.app.name as commented out in the code that i posted just to show two 
different ways i was using to get it to work. 
   
   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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to