diff --git a/README.md b/README.md index 2d7e072..e36dad4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Overview -Version: 1.1.0 +Version: 1.1.1 API Scaladoc: [SparkHelper](http://xavierguihot.com/spark_helper/#com.spark_helper.SparkHelper$) @@ -126,7 +126,7 @@ assert(DateHelper.nDaysAfterDate(3, "20170307") == "20170310") ### Monitor: The full list of methods is available at -[scaladoc](http://xavierguihot.com/spark_helper/#com.spark_helper.Monitor$) +[Monitor](http://xavierguihot.com/spark_helper/#com.spark_helper.Monitor$) It's a simple logger/report which contains a report that one can update from the driver and a success state. The idea is to persist job executions logs and @@ -253,7 +253,7 @@ With sbt, add these lines to your build.sbt: ```scala resolvers += "jitpack" at "https://jitpack.io" -libraryDependencies += "com.github.xavierguihot" % "spark_helper" % "v1.1.0" +libraryDependencies += "com.github.xavierguihot" % "spark_helper" % "v1.1.1" ``` With maven, add these lines to your pom.xml: @@ -269,7 +269,7 @@ With maven, add these lines to your pom.xml: com.github.xavierguihot spark_helper - v1.1.0 + v1.1.1 ``` @@ -283,6 +283,6 @@ allprojects { } dependencies { - compile 'com.github.xavierguihot:spark_helper:v1.1.0' + compile 'com.github.xavierguihot:spark_helper:v1.1.1' } ``` diff --git a/build.sbt b/build.sbt index c212428..bc2ebbc 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "spark_helper" -version := "1.1.0" +version := "1.1.1" scalaVersion := "2.11.12" diff --git a/src/main/scala/com/spark_helper/Monitor.scala b/src/main/scala/com/spark_helper/Monitor.scala index b8c286f..3866cbb 100644 --- a/src/main/scala/com/spark_helper/Monitor.scala +++ b/src/main/scala/com/spark_helper/Monitor.scala @@ -185,6 +185,7 @@ object Monitor { def setTitle(title: String): Unit = { reportTitle = Some(title) reportHeader = buildReportHeader() + storeCurrent() } /** Sets the report's contact list. @@ -206,6 +207,7 @@ object Monitor { def addContacts(contacts: List[String]): Unit = { pointsOfContact = Some(contacts) reportHeader = buildReportHeader() + storeCurrent() } /** Sets the report's description. @@ -227,6 +229,7 @@ object Monitor { def addDescription(description: String): Unit = { reportDescription = Some(description) reportHeader = buildReportHeader() + storeCurrent() } /** Sets the folder in which logs are stored. @@ -250,6 +253,7 @@ object Monitor { def setLogFolder(logFolder: String): Unit = { logDirectory = Some(logFolder) prepareLogFolder() + storeCurrent() } /** Activates the purge of logs and sets the purge window. @@ -573,6 +577,12 @@ object Monitor { // And if the logFolder parameter has been set, we also update live the log // file: + storeCurrent() + } + + /** Updates the current stored version of logs in file + * logFolder/current.ongoing */ + private def storeCurrent(): Unit = logDirectory.foreach { case logFolder => { @@ -588,7 +598,6 @@ object Monitor { HdfsHelper.writeToHdfsFile(ongoingReport, s"$logFolder/current.ongoing") } } - } private def purgeOutdatedLogs(logFolder: String, window: Int): Unit = {