Skip to content

Commit

Permalink
Bump cron-utils to 9.0.0 the latest release (#346)
Browse files Browse the repository at this point in the history
* Bump cron-utils to 9.0.0 the latest release
* removing 310 backport completely
  • Loading branch information
kensipe authored Jul 3, 2019
1 parent a74b88c commit b28106a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
2 changes: 0 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ lazy val api = (project in file("api"))
Dependencies.macWireProxy,
Dependencies.yaml,
Dependencies.cronUtils,
Dependencies.threeten,
Dependencies.jsonValidate,
Dependencies.iteratees,
Dependencies.playAhcWS,
Expand Down Expand Up @@ -174,7 +173,6 @@ lazy val jobs = (project in file("jobs"))
Dependencies.macWireMacros,
Dependencies.macWireUtil,
Dependencies.macWireProxy,
Dependencies.threeten,
Dependencies.cronUtils,
Dependencies.akka,
Dependencies.twitterCommons,
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# 0.6.NEXT

* Updated to the latest version of cron-utils `9.0.0` and removed threeten-backport. This fixes a number of cron related issues in the underlying dependencies.
* When querying run detail with `embed=history`, `successfulFinishedRuns` and `failedFinishedRuns` contains new field `tasks` which is an array of taskIds of that finished run. This will allow people to query task ids even for finished job runs.
* Fixed a bug when task status was not updated after the task turned running (when querying embed=activeRuns).
* [DCOS_OSS-5166](https://jira.mesosphere.com/browse/DCOS_OSS-5166) Fixed metronome not using revive operation
Expand Down
21 changes: 5 additions & 16 deletions jobs/src/main/scala/dcos/metronome/model/CronSpec.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package dcos.metronome
package model

import java.time.{ Instant, ZoneId, ZonedDateTime }
import java.time.ZonedDateTime

import com.cronutils.model.definition.{ CronConstraint, CronDefinition, CronDefinitionBuilder }
import com.cronutils.model.time.ExecutionTime
import com.cronutils.model.Cron
import com.cronutils.model.definition.{ CronConstraint, CronDefinition, CronDefinitionBuilder }
import com.cronutils.model.field.expression.{ Between, On }
import com.cronutils.model.field.value.IntegerFieldValue
import com.cronutils.model.field.{ CronField, CronFieldName }
import com.cronutils.model.time.ExecutionTime
import com.cronutils.parser.CronParser
import org.threeten.bp.{ Instant => ThreeTenInstant, ZoneId => ThreeTenZoneId, ZonedDateTime => ThreeTenZonedDateTime }

import scala.util.control.NonFatal

Expand All @@ -19,21 +18,11 @@ class CronSpec(val cron: Cron) {
private[this] lazy val executionTime: ExecutionTime = ExecutionTime.forCron(cron)

def nextExecution(from: ZonedDateTime): ZonedDateTime = {
val fromDateTime: ThreeTenZonedDateTime = javaTimeToThreetenTime(from)
executionTime.nextExecution(threetenToJavaTime(fromDateTime)).get()
executionTime.nextExecution(from).get()
}

def lastExecution(from: ZonedDateTime): ZonedDateTime = {
val fromDateTime: ThreeTenZonedDateTime = javaTimeToThreetenTime(from)
executionTime.lastExecution(threetenToJavaTime(fromDateTime)).get()
}

private def threetenToJavaTime(from: ThreeTenZonedDateTime): ZonedDateTime = {
ZonedDateTime.ofInstant(Instant.ofEpochMilli(from.toInstant.toEpochMilli), ZoneId.of(from.getZone.getId))
}

private def javaTimeToThreetenTime(from: ZonedDateTime): ThreeTenZonedDateTime = {
ThreeTenZonedDateTime.ofInstant(ThreeTenInstant.ofEpochMilli(from.toInstant.toEpochMilli), ThreeTenZoneId.of(from.getZone.toString))
executionTime.lastExecution(from).get()
}

override def hashCode(): Int = cron.hashCode()
Expand Down
4 changes: 1 addition & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ object Dependencies {
val PlayJson = "2.6.10"
val ScalaTestPlusPlay = "3.1.2"
val PlayIteratees = "2.6.1"
val CronUtils = "7.0.5"
val Threeten = "1.3.3"
val CronUtils = "9.0.0"
val WixAccord = "0.7.1"
val Akka = "2.5.15"
val Mockito = "2.21.0"
Expand All @@ -36,7 +35,6 @@ object Dependencies {
val marathon = "mesosphere.marathon" %% "marathon" % V.Marathon exclude("com.typesafe.play", "*") exclude("mesosphere.marathon", "ui") exclude("mesosphere", "chaos") exclude("org.apache.hadoop", "hadoop-hdfs") exclude("org.apache.hadoop", "hadoop-common") exclude("mesosphere.marathon", "plugin-interface_2.12")
val marathonPlugin = "mesosphere.marathon" %% "plugin-interface" % V.MarathonPluginInterface
val cronUtils = "com.cronutils" % "cron-utils" % V.CronUtils exclude("org.threeten", "threetenbp")
val threeten = "org.threeten" % "threetenbp" % V.Threeten
val wixAccord = "com.wix" %% "accord-core" % V.WixAccord
val akka = "com.typesafe.akka" %% "akka-actor" % V.Akka
val jsonValidate = "com.eclipsesource" %% "play-json-schema-validator" % V.JsonValidate
Expand Down

0 comments on commit b28106a

Please sign in to comment.