wonook commented on a change in pull request #18: [NEMO-45] Distributed 
Nemo-Spark
URL: https://github.com/apache/incubator-nemo/pull/18#discussion_r190495764
 
 

 ##########
 File path: 
compiler/frontend/spark/src/main/java/edu/snu/nemo/compiler/frontend/spark/sql/SparkSession.java
 ##########
 @@ -311,7 +319,39 @@ public Builder master(final String master) {
 
     @Override
     public SparkSession getOrCreate() {
-      
UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser("nemo_user"));
+      if (!options.containsKey("spark.master")) { // default spark_master 
option.
+        return this.master("local[*]").getOrCreate();
+      }
+
+      
UserGroupInformation.setLoginUser(UserGroupInformation.createRemoteUser("ubuntu"));
+
+      if (!options.containsKey("nemo.appName")) { // Called while compilation
+        try {
+          // get and override configurations from JobLauncher.
+          final Configuration configurations = JobLauncher.getBuiltJobConf();
+          final Injector injector = 
Tang.Factory.getTang().newInjector(configurations);
+
+          this.config("nemo.appName", 
injector.getNamedInstance(JobConf.JobId.class));
+          this.config("nemo.appArgs", 
injector.getNamedInstance(JobConf.UserMainArguments.class));
+          this.config("nemo.fileDirectory", 
injector.getNamedInstance(JobConf.FileDirectory.class));
+          final String master = 
injector.getNamedInstance(JobConf.DeployMode.class);
+          this.config("nemo.master", master);
+          this.config("nemo.deployMode", master.equals("yarn") ? "cluster" : 
"client"); // client or cluster
+        } catch (final InjectionException e) {
+          throw new RuntimeException(e);
+        }
+      } else { // Called by Executor or something else.
 
 Review comment:
   Can this part be more specific and descriptive? I'm unsure when this is 
being used. Is there an example?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to