{"action":"created","comment":{"url":"https://api.github.com/repos/apache/hive/pulls/comments/203244848","pull_request_review_id":138095748,"id":203244848,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzI0NDg0OA==","diff_hunk":"@@ -36,18 +54,78 @@ public KillQueryImpl(OperationManager operationManager) {\n     this.operationManager = operationManager;\n   }\n \n+  public static Set<ApplicationId> getChildYarnJobs(Configuration conf, String tag) {\n+    Set<ApplicationId> childYarnJobs = new HashSet<ApplicationId>();\n+    GetApplicationsRequest gar = GetApplicationsRequest.newInstance();\n+    gar.setScope(ApplicationsRequestScope.OWN);\n+    gar.setApplicationTags(Collections.singleton(tag));\n+\n+    try {\n+      ApplicationClientProtocol proxy = ClientRMProxy.createRMProxy(conf, ApplicationClientProtocol.class);\n+      GetApplicationsResponse apps = proxy.getApplications(gar);\n+      List<ApplicationReport> appsList = apps.getApplicationList();\n+      for(ApplicationReport appReport : appsList) {\n+        childYarnJobs.add(appReport.getApplicationId());\n+      }\n+    } catch (YarnException | IOException ioe) {\n+      throw new RuntimeException(\"Exception occurred while finding child jobs\", ioe);\n+    }\n+\n+    if (childYarnJobs.isEmpty()) {\n+      LOG.info(\"No child applications found\");\n+    } else {\n+      LOG.info(\"Found child YARN applications: \" + StringUtils.join(childYarnJobs, \",\"));\n+    }\n+\n+    return childYarnJobs;\n+  }\n+\n+  public static void killChildYarnJobs(Configuration conf, String tag) {\n+    try {\n+      Set<ApplicationId> childYarnJobs = getChildYarnJobs(conf, tag);\n+      if (!childYarnJobs.isEmpty()) {\n+        YarnClient yarnClient = YarnClient.createYarnClient();\n+        yarnClient.init(conf);\n+        yarnClient.start();\n+        for (ApplicationId app : childYarnJobs) {\n+          yarnClient.killApplication(app);\n+        }\n+      }\n+    } catch (IOException | YarnException ye) {\n+      throw new RuntimeException(\"Exception occurred while killing child job(s)\", ye);\n+    }\n+  }\n+\n   @Override\n   public void killQuery(String queryId, String errMsg) throws HiveException {\n     try {\n+      String queryTag = null;\n       Operation operation = operationManager.getOperationByQueryId(queryId);\n       if (operation == null) {\n-        LOG.info(\"Query not found: \" + queryId);\n+        // Check if user has passed the query tag to kill the operation.\n+        operation = operationManager.getOperationByQueryTag(queryId);\n+        if (operation == null) {\n+          LOG.info(\"Query not found: \" + queryId);\n+        }\n       } else {\n+        queryTag = operation.getQueryTag();\n+      }\n+\n+      if (operation != null) {\n         OperationHandle handle = operation.getHandle();\n         operationManager.cancelOperation(handle, errMsg);\n       }\n+\n+      if (queryTag == null) {","path":"service/src/java/org/apache/hive/service/server/KillQueryImpl.java","position":101,"original_position":101,"commit_id":"dbd004a68d76c6b852ca3c06a200735a2a4d9468","original_commit_id":"dbd004a68d76c6b852ca3c06a200735a2a4d9468","user":{"login":"maheshk114","id":19660171,"node_id":"MDQ6VXNlcjE5NjYwMTcx","avatar_url":"https://avatars3.githubusercontent.com/u/19660171?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshk114","html_url":"https://github.com/maheshk114","followers_url":"https://api.github.com/users/maheshk114/followers","following_url":"https://api.github.com/users/maheshk114/following{/other_user}","gists_url":"https://api.github.com/users/maheshk114/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshk114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshk114/subscriptions","organizations_url":"https://api.github.com/users/maheshk114/orgs","repos_url":"https://api.github.com/users/maheshk114/repos","events_url":"https://api.github.com/users/maheshk114/events{/privacy}","received_events_url":"https://api.github.com/users/maheshk114/received_events","type":"User","site_admin":false},"body":"done","created_at":"2018-07-18T03:56:31Z","updated_at":"2018-07-18T03:56:31Z","html_url":"https://github.com/apache/hive/pull/376#discussion_r203244848","pull_request_url":"https://api.github.com/repos/apache/hive/pulls/376","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/hive/pulls/comments/203244848"},"html":{"href":"https://github.com/apache/hive/pull/376#discussion_r203244848"},"pull_request":{"href":"https://api.github.com/repos/apache/hive/pulls/376"}},"in_reply_to_id":202949576},"pull_request":{"url":"https://api.github.com/repos/apache/hive/pulls/376","id":196523414,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NTIzNDE0","html_url":"https://github.com/apache/hive/pull/376","diff_url":"https://github.com/apache/hive/pull/376.diff","patch_url":"https://github.com/apache/hive/pull/376.patch","issue_url":"https://api.github.com/repos/apache/hive/issues/376","number":376,"state":"open","locked":false,"title":"HIVE-19924 : Tag distcp jobs run by Repl Load","user":{"login":"maheshk114","id":19660171,"node_id":"MDQ6VXNlcjE5NjYwMTcx","avatar_url":"https://avatars3.githubusercontent.com/u/19660171?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshk114","html_url":"https://github.com/maheshk114","followers_url":"https://api.github.com/users/maheshk114/followers","following_url":"https://api.github.com/users/maheshk114/following{/other_user}","gists_url":"https://api.github.com/users/maheshk114/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshk114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshk114/subscriptions","organizations_url":"https://api.github.com/users/maheshk114/orgs","repos_url":"https://api.github.com/users/maheshk114/repos","events_url":"https://api.github.com/users/maheshk114/events{/privacy}","received_events_url":"https://api.github.com/users/maheshk114/received_events","type":"User","site_admin":false},"body":"HIVE-19924 : Tag distcp jobs run by Repl Load","created_at":"2018-06-21T17:27:35Z","updated_at":"2018-07-18T03:56:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de80047678bd2070e8e11b7d1108dc82b387bdc7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/hive/pulls/376/commits","review_comments_url":"https://api.github.com/repos/apache/hive/pulls/376/comments","review_comment_url":"https://api.github.com/repos/apache/hive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/hive/issues/376/comments","statuses_url":"https://api.github.com/repos/apache/hive/statuses/dbd004a68d76c6b852ca3c06a200735a2a4d9468","head":{"label":"maheshk114:BUG-102286","ref":"BUG-102286","sha":"dbd004a68d76c6b852ca3c06a200735a2a4d9468","user":{"login":"maheshk114","id":19660171,"node_id":"MDQ6VXNlcjE5NjYwMTcx","avatar_url":"https://avatars3.githubusercontent.com/u/19660171?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshk114","html_url":"https://github.com/maheshk114","followers_url":"https://api.github.com/users/maheshk114/followers","following_url":"https://api.github.com/users/maheshk114/following{/other_user}","gists_url":"https://api.github.com/users/maheshk114/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshk114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshk114/subscriptions","organizations_url":"https://api.github.com/users/maheshk114/orgs","repos_url":"https://api.github.com/users/maheshk114/repos","events_url":"https://api.github.com/users/maheshk114/events{/privacy}","received_events_url":"https://api.github.com/users/maheshk114/received_events","type":"User","site_admin":false},"repo":{"id":118883759,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg4ODM3NTk=","name":"hive","full_name":"maheshk114/hive","owner":{"login":"maheshk114","id":19660171,"node_id":"MDQ6VXNlcjE5NjYwMTcx","avatar_url":"https://avatars3.githubusercontent.com/u/19660171?v=4","gravatar_id":"","url":"https://api.github.com/users/maheshk114","html_url":"https://github.com/maheshk114","followers_url":"https://api.github.com/users/maheshk114/followers","following_url":"https://api.github.com/users/maheshk114/following{/other_user}","gists_url":"https://api.github.com/users/maheshk114/gists{/gist_id}","starred_url":"https://api.github.com/users/maheshk114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maheshk114/subscriptions","organizations_url":"https://api.github.com/users/maheshk114/orgs","repos_url":"https://api.github.com/users/maheshk114/repos","events_url":"https://api.github.com/users/maheshk114/events{/privacy}","received_events_url":"https://api.github.com/users/maheshk114/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maheshk114/hive","description":"Mirror of Apache Hive","fork":true,"url":"https://api.github.com/repos/maheshk114/hive","forks_url":"https://api.github.com/repos/maheshk114/hive/forks","keys_url":"https://api.github.com/repos/maheshk114/hive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maheshk114/hive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maheshk114/hive/teams","hooks_url":"https://api.github.com/repos/maheshk114/hive/hooks","issue_events_url":"https://api.github.com/repos/maheshk114/hive/issues/events{/number}","events_url":"https://api.github.com/repos/maheshk114/hive/events","assignees_url":"https://api.github.com/repos/maheshk114/hive/assignees{/user}","branches_url":"https://api.github.com/repos/maheshk114/hive/branches{/branch}","tags_url":"https://api.github.com/repos/maheshk114/hive/tags","blobs_url":"https://api.github.com/repos/maheshk114/hive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maheshk114/hive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maheshk114/hive/git/refs{/sha}","trees_url":"https://api.github.com/repos/maheshk114/hive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maheshk114/hive/statuses/{sha}","languages_url":"https://api.github.com/repos/maheshk114/hive/languages","stargazers_url":"https://api.github.com/repos/maheshk114/hive/stargazers","contributors_url":"https://api.github.com/repos/maheshk114/hive/contributors","subscribers_url":"https://api.github.com/repos/maheshk114/hive/subscribers","subscription_url":"https://api.github.com/repos/maheshk114/hive/subscription","commits_url":"https://api.github.com/repos/maheshk114/hive/commits{/sha}","git_commits_url":"https://api.github.com/repos/maheshk114/hive/git/commits{/sha}","comments_url":"https://api.github.com/repos/maheshk114/hive/comments{/number}","issue_comment_url":"https://api.github.com/repos/maheshk114/hive/issues/comments{/number}","contents_url":"https://api.github.com/repos/maheshk114/hive/contents/{+path}","compare_url":"https://api.github.com/repos/maheshk114/hive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maheshk114/hive/merges","archive_url":"https://api.github.com/repos/maheshk114/hive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maheshk114/hive/downloads","issues_url":"https://api.github.com/repos/maheshk114/hive/issues{/number}","pulls_url":"https://api.github.com/repos/maheshk114/hive/pulls{/number}","milestones_url":"https://api.github.com/repos/maheshk114/hive/milestones{/number}","notifications_url":"https://api.github.com/repos/maheshk114/hive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maheshk114/hive/labels{/name}","releases_url":"https://api.github.com/repos/maheshk114/hive/releases{/id}","deployments_url":"https://api.github.com/repos/maheshk114/hive/deployments","created_at":"2018-01-25T08:17:10Z","updated_at":"2018-01-25T08:17:57Z","pushed_at":"2018-07-12T09:04:11Z","git_url":"git://github.com/maheshk114/hive.git","ssh_url":"git@github.com:maheshk114/hive.git","clone_url":"https://github.com/maheshk114/hive.git","svn_url":"https://github.com/maheshk114/hive","homepage":null,"size":421975,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"5ade74060c9615a658d66fb0dac397671d2368ba","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":206444,"node_id":"MDEwOlJlcG9zaXRvcnkyMDY0NDQ=","name":"hive","full_name":"apache/hive","owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/hive","description":"Mirror of Apache Hive","fork":false,"url":"https://api.github.com/repos/apache/hive","forks_url":"https://api.github.com/repos/apache/hive/forks","keys_url":"https://api.github.com/repos/apache/hive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/hive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/hive/teams","hooks_url":"https://api.github.com/repos/apache/hive/hooks","issue_events_url":"https://api.github.com/repos/apache/hive/issues/events{/number}","events_url":"https://api.github.com/repos/apache/hive/events","assignees_url":"https://api.github.com/repos/apache/hive/assignees{/user}","branches_url":"https://api.github.com/repos/apache/hive/branches{/branch}","tags_url":"https://api.github.com/repos/apache/hive/tags","blobs_url":"https://api.github.com/repos/apache/hive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/hive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/hive/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/hive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/hive/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/hive/languages","stargazers_url":"https://api.github.com/repos/apache/hive/stargazers","contributors_url":"https://api.github.com/repos/apache/hive/contributors","subscribers_url":"https://api.github.com/repos/apache/hive/subscribers","subscription_url":"https://api.github.com/repos/apache/hive/subscription","commits_url":"https://api.github.com/repos/apache/hive/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/hive/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/hive/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/hive/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/hive/contents/{+path}","compare_url":"https://api.github.com/repos/apache/hive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/hive/merges","archive_url":"https://api.github.com/repos/apache/hive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/hive/downloads","issues_url":"https://api.github.com/repos/apache/hive/issues{/number}","pulls_url":"https://api.github.com/repos/apache/hive/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/hive/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/hive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/hive/labels{/name}","releases_url":"https://api.github.com/repos/apache/hive/releases{/id}","deployments_url":"https://api.github.com/repos/apache/hive/deployments","created_at":"2009-05-21T02:31:01Z","updated_at":"2018-07-18T03:19:10Z","pushed_at":"2018-07-18T03:18:37Z","git_url":"git://github.com/apache/hive.git","ssh_url":"git@github.com:apache/hive.git","clone_url":"https://github.com/apache/hive.git","svn_url":"https://github.com/apache/hive","homepage":null,"size":425569,"stargazers_count":1982,"watchers_count":1982,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2042,"mirror_url":null,"archived":false,"open_issues_count":177,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2042,"open_issues":177,"watchers":1982,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/hive/pulls/376"},"html":{"href":"https://github.com/apache/hive/pull/376"},"issue":{"href":"https://api.github.com/repos/apache/hive/issues/376"},"comments":{"href":"https://api.github.com/repos/apache/hive/issues/376/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/hive/pulls/376/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/hive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/hive/pulls/376/commits"},"statuses":{"href":"https://api.github.com/repos/apache/hive/statuses/dbd004a68d76c6b852ca3c06a200735a2a4d9468"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"maheshk114"}}