jihoonson commented on a change in pull request #6828: Kill Hadoop MR task on 
kill of Hadoop ingestion task 
URL: https://github.com/apache/incubator-druid/pull/6828#discussion_r248163402
 
 

 ##########
 File path: 
indexing-service/src/main/java/org/apache/druid/indexing/common/task/HadoopIndexTask.java
 ##########
 @@ -412,6 +430,57 @@ private TaskStatus runInternal(TaskToolbox toolbox) 
throws Exception
     }
   }
 
+  @Override
+  public void stopGracefully()
+  {
+    final ClassLoader oldLoader = 
Thread.currentThread().getContextClassLoader();
+    ObjectMapper objectMapper = new ObjectMapper();
+    File hadoopJobIdFile = new File(getHadoopJobIdFileName());
+    String jobId = null;
+
+    try {
+      if (hadoopJobIdFile.exists()) {
+        jobId = objectMapper.readValue(hadoopJobIdFile, String.class);
+      }
+    }
+    catch (Exception e) {
+      log.info("Exeption while reading json file from path: " + 
hadoopJobIdFile);
+      log.error(Throwables.getStackTraceAsString(e));
+    }
+
+    try {
+      if (jobId != null) {
+        ClassLoader loader = 
HadoopTask.buildClassLoader(getHadoopDependencyCoordinates(),
+            taskConfig.getDefaultHadoopCoordinates());
+
+        Object killMRJobInnerProcessingRunner = 
getForeignClassloaderObject("org.apache.druid.indexing.common.task.HadoopIndexTask$HadoopKillMRJobIdProcessingRunner",
 
 Review comment:
   Format:
   
   ```java
           Object killMRJobInnerProcessingRunner = getForeignClassloaderObject(
               
"org.apache.druid.indexing.common.task.HadoopIndexTask$HadoopKillMRJobIdProcessingRunner",
               loader
           );
   ```

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to