seojangho commented on a change in pull request #73: [Nemo-62] Support Multiple 
Jobs Submission in a Single User Program
URL: https://github.com/apache/incubator-nemo/pull/73#discussion_r203346684
 
 

 ##########
 File path: client/src/main/java/edu/snu/nemo/client/JobLauncher.java
 ##########
 @@ -109,36 +113,91 @@ public static void main(final String[] args) throws 
Exception {
     // Get DeployMode Conf
     deployModeConf = Configurations.merge(getDeployModeConf(builtJobConf), 
clientConf);
 
-    // Launch client main
-    runUserProgramMain(builtJobConf);
+    // Start Driver and launch user program.
+    try {
+      if (jobAndDriverConf == null || deployModeConf == null || builtJobConf 
== null) {
+        throw new RuntimeException("Configuration for launching driver is not 
ready");
+      }
+
+      // Launch driver
+      LOG.info("Launching driver");
+      driverReadyLatch = new CountDownLatch(1);
+      driverLauncher = DriverLauncher.getLauncher(deployModeConf);
+      driverLauncher.submit(jobAndDriverConf, 500);
+      // When the driver is up and the resource is ready, the ResourceReady 
message is delivered.
 
-    driverRPCServer.shutdown();
+      // Launch client main
+      runUserProgramMain(builtJobConf);
+
+      // Trigger driver shutdown afterwards
+      driverRPCServer.send(ControlMessage.ClientToDriverMessage.newBuilder()
+          
.setType(ControlMessage.ClientToDriverMessageType.DriverShutdown).build());
+      // Wait for driver to naturally finish
+      synchronized (driverLauncher) {
 
 Review comment:
   Do we need this? Can you explain a race condition scenario which this 
`synchronized` block will prevent?

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


With regards,
Apache Git Services

Reply via email to