Github user ajbozarth commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15984#discussion_r89244508
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -535,6 +535,26 @@ private[history] class FsHistoryProvider(conf: 
SparkConf, clock: Clock)
         }
       }
     
    +  override def deleteLog(appId: String, attemptId: Option[String]): Unit = 
{
    +    applications.get(appId) match {
    +      case Some(appInfo) =>
    +        appInfo.attempts.filter { attempt =>
    +          attempt.attemptId.isEmpty || attemptId.isEmpty || 
attempt.attemptId.get == attemptId.get
    +        }.foreach { attempt =>
    +          try {
    +            fs.delete(new Path(logDir, attempt.logPath), true)
    +            applications.remove(appId)
    +          } catch {
    +            case e: AccessControlException =>
    +              logInfo(s"No permission to delete ${attempt.logPath}, 
ignoring.")
    +            case t: IOException =>
    +              logError(s"IOException in cleaning ${attempt.logPath}", t)
    +          }
    +        }
    +      case None => logError(s"Can't delete, no application ${appId} found")
    --- End diff --
    
    I'm not sure if the way I'm handling the logging/exceptions here is the 
best possible. I'm open to input, this logic was based on logic in 
`writeEventLogs` and `cleanLogs` in this file.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to