{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/8216","labels_url":"https://api.github.com/repos/apache/spark/issues/8216/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/8216/comments","events_url":"https://api.github.com/repos/apache/spark/issues/8216/events","html_url":"https://github.com/apache/spark/pull/8216","id":101112110,"number":8216,"title":"[SPARK-10001] [CORE] Allow Ctrl-C in spark-shell to kill running job","user":{"login":"piaozhexiu","id":179618,"avatar_url":"https://avatars.githubusercontent.com/u/179618?v=3","gravatar_id":"","url":"https://api.github.com/users/piaozhexiu","html_url":"https://github.com/piaozhexiu","followers_url":"https://api.github.com/users/piaozhexiu/followers","following_url":"https://api.github.com/users/piaozhexiu/following{/other_user}","gists_url":"https://api.github.com/users/piaozhexiu/gists{/gist_id}","starred_url":"https://api.github.com/users/piaozhexiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piaozhexiu/subscriptions","organizations_url":"https://api.github.com/users/piaozhexiu/orgs","repos_url":"https://api.github.com/users/piaozhexiu/repos","events_url":"https://api.github.com/users/piaozhexiu/events{/privacy}","received_events_url":"https://api.github.com/users/piaozhexiu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2015-08-14T22:06:46Z","updated_at":"2015-09-04T21:46:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/8216","html_url":"https://github.com/apache/spark/pull/8216","diff_url":"https://github.com/apache/spark/pull/8216.diff","patch_url":"https://github.com/apache/spark/pull/8216.patch"},"body":"This patch attaches a signal handler for SIGINT to JobWaiter when a job is running and detaches it as soon as the job is finished. When ctrl-c is pressed during this time, spark-shell cancels the running job.\r\n\r\nIt's worth noting that signal handler is only overridden when job is running. So if ctrl-c is pressed when spark-shell is idle, it will still interrupt JVM and exit the shell (same as now).\r\n\r\nIn addition, if ctrl-c is pressed multiple times when job is running, it will interrupt JVM and exit the shell. This is to avoid any case that the shell becomes unresponsive. For eg, consider this scenario. User submits a job in the shell. But since the job lists a lot of files before running, it might be hanging in the driver. In this case, user can interrupt JVM and exit the shell by ctrl-c'ing twice.\r\n\r\nHere is summary-\r\n\r\n\\# | case | before | after\r\n---- | ------------| -------- | ------\r\n1 | shell is idle | ctrl-c will exit the shell | ctrl-c will exit the shell \r\n2 | job is submitted but not yet running (e.g. driver listing input files) | ctrl-c will exit the shell | ctrl-c will exit the shell [a]\r\n3 | job is submitted and running on cluster | ctrl-c will exit the shell | ctrl-c will not exit the shell but cancel the job [b]\r\n\r\nThis patch basically improves ``case 3`` by allowing the user to cancel a running job on cluster w/o exiting the shell.\r\n\r\n[a] 1st ctrl-c will print a log message saying ``Cancelling running job.. This might take some time, so be patient.  Press Ctrl-C again to kill JVM.`` 2nd ctrl-c will exit the shell.\r\n[b] when job is running, ctrl-c immediately cancels the job, and the prompt is returned to user."},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/137860880","html_url":"https://github.com/apache/spark/pull/8216#issuecomment-137860880","issue_url":"https://api.github.com/repos/apache/spark/issues/8216","id":137860880,"user":{"login":"SparkQA","id":8108735,"avatar_url":"https://avatars.githubusercontent.com/u/8108735?v=3","gravatar_id":"","url":"https://api.github.com/users/SparkQA","html_url":"https://github.com/SparkQA","followers_url":"https://api.github.com/users/SparkQA/followers","following_url":"https://api.github.com/users/SparkQA/following{/other_user}","gists_url":"https://api.github.com/users/SparkQA/gists{/gist_id}","starred_url":"https://api.github.com/users/SparkQA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SparkQA/subscriptions","organizations_url":"https://api.github.com/users/SparkQA/orgs","repos_url":"https://api.github.com/users/SparkQA/repos","events_url":"https://api.github.com/users/SparkQA/events{/privacy}","received_events_url":"https://api.github.com/users/SparkQA/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T21:46:25Z","updated_at":"2015-09-04T21:46:25Z","body":"  [Test build #42012 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42012/console) for   PR 8216 at commit [`cb3b73f`](https://github.com/apache/spark/commit/cb3b73f2f7e79d009ea4ed152e8551ac79794191).\n * This patch **passes all tests**.\n * This patch merges cleanly.\n * This patch adds no public classes."}}