Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/246#discussion_r11011437 --- Diff: core/src/main/scala/org/apache/spark/ui/jobs/KillPage.scala --- @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.ui.jobs + +import java.util.Date +import javax.servlet.http.HttpServletRequest + +import scala.xml.Node + +import org.apache.spark.ui.Page._ +import org.apache.spark.ui.{WebUI, UIUtils} +import org.apache.spark.util.{Utils, Distribution} + +/** Page showing statistics and task list for a given stage */ +private[ui] class KillPage(parent: JobProgressUI) { + private val appName = parent.appName + private val basePath = parent.basePath + private lazy val listener = parent.listener + private lazy val sc = parent.sc + + def render(request: HttpServletRequest): Seq[Node] = { + listener.synchronized { + val stageId = request.getParameter("id").toInt + val jobIdOpt = listener.stageIdToJobId.get(stageId) + + if (!parent.killEnabled) { + val content = + <div> + <h4>Option disbaled</h4> Cannot kill jobs through the UI. + Please set spark.ui.killEnabled to change this behavior + </div> + return UIUtils.headerSparkPage( + content, basePath, appName, "Disabled option", Stages) + + } + + jobIdOpt match { + case Some(jobId) => { + sc.cancelJob(jobId) + val content = + <div> + Stage {stageId} and Job {jobId} are being killed + </div> + return UIUtils.headerSparkPage( + content, basePath, appName, "Stage %s is being terminated".format(stageId), Stages) + } + case _ => { --- End diff -- Isn't this always going to be None?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---