Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-20271 Improve HoS query cancellation handling
  3. HIVE-16422

Should kill running Spark Jobs when a query is cancelled.

Log workAgile BoardRank to TopRank to BottomBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersConvert to IssueMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.0
    • 3.0.0
    • Spark
    • None

    Description

      Should kill running Spark Jobs when a query is cancelled. When a query is cancelled, Driver.releaseDriverContext will be called by Driver.close. releaseDriverContext will call DriverContext.shutdown which will call all the running tasks' shutdown.

        public synchronized void shutdown() {
          LOG.debug("Shutting down query " + ctx.getCmd());
          shutdown = true;
          for (TaskRunner runner : running) {
            if (runner.isRunning()) {
              Task<?> task = runner.getTask();
              LOG.warn("Shutting down task : " + task);
              try {
                task.shutdown();
              } catch (Exception e) {
                console.printError("Exception on shutting down task " + task.getId() + ": " + e);
              }
              Thread thread = runner.getRunner();
              if (thread != null) {
                thread.interrupt();
              }
            }
          }
          running.clear();
        }
      

      since SparkTask didn't implement shutdown method to kill the running spark job, the spark job may be still running after the query is cancelled. So it will be good to kill the spark job in SparkTask.shutdown to save cluster resource.

      Attachments

        1. HIVE-16422.000.txt
          2 kB
          Zhihai Xu

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            zxu Zhihai Xu Assign to me
            zxu Zhihai Xu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment