Ottomata has submitted this change and it was merged. Change subject: Correct CamusPartitionChecker bug ......................................................................
Correct CamusPartitionChecker bug CamusPartitionChecker was flagging currently importing hour instead of really imported one (previous) Change-Id: I3b43e735faa629b8923ce142da2d456039d0853a --- M refinery-job/src/main/scala/org/wikimedia/analytics/refinery/job/CamusPartitionChecker.scala M refinery-job/src/test/scala/org/wikimedia/analytics/refinery/job/TestCamusPartitionChecker.scala 2 files changed, 7 insertions(+), 7 deletions(-) Approvals: Ottomata: Verified; Looks good to me, approved diff --git a/refinery-job/src/main/scala/org/wikimedia/analytics/refinery/job/CamusPartitionChecker.scala b/refinery-job/src/main/scala/org/wikimedia/analytics/refinery/job/CamusPartitionChecker.scala index 847e693..7c371b1 100644 --- a/refinery-job/src/main/scala/org/wikimedia/analytics/refinery/job/CamusPartitionChecker.scala +++ b/refinery-job/src/main/scala/org/wikimedia/analytics/refinery/job/CamusPartitionChecker.scala @@ -48,11 +48,11 @@ * @param t2 The second timestamp (youngest) * @return the hours having happened between t1 and t2 in format (year, month, day, hour) */ - def hoursInBetween(t1: Long, t2: Long): Seq[(Int, Int, Int, Int)] = { + def finishedHoursInBetween(t1: Long, t2: Long): Seq[(Int, Int, Int, Int)] = { val oldestNextHour = new DateTime(t1 , DateTimeZone.UTC).hourOfDay.roundCeilingCopy val youngestPreviousHour = new DateTime(t2, DateTimeZone.UTC).hourOfDay.roundFloorCopy for (h <- 0 to Hours.hoursBetween(oldestNextHour, youngestPreviousHour).getHours ) yield { - val fullHour: DateTime = oldestNextHour + h.hours + val fullHour: DateTime = oldestNextHour + h.hours - 1.hours (fullHour.year.get, fullHour.monthOfYear.get, fullHour.dayOfMonth.get, fullHour.hourOfDay.get) } } @@ -88,7 +88,7 @@ (previousTopic.matches(topicsWhitelist))) { if ((currentTopicsAndOldestTimes.contains(previousTopic)) && (currentTopicsAndOldestTimes.get(previousTopic).get > previousTime)) { - val hours = hoursInBetween(previousTime, currentTopicsAndOldestTimes.get(previousTopic).get) + val hours = finishedHoursInBetween(previousTime, currentTopicsAndOldestTimes.get(previousTopic).get) map + (previousTopic -> hours) } else throw new IllegalStateException( diff --git a/refinery-job/src/test/scala/org/wikimedia/analytics/refinery/job/TestCamusPartitionChecker.scala b/refinery-job/src/test/scala/org/wikimedia/analytics/refinery/job/TestCamusPartitionChecker.scala index 0909ee8..1ac4c62 100644 --- a/refinery-job/src/test/scala/org/wikimedia/analytics/refinery/job/TestCamusPartitionChecker.scala +++ b/refinery-job/src/test/scala/org/wikimedia/analytics/refinery/job/TestCamusPartitionChecker.scala @@ -24,16 +24,16 @@ val t1: Long = 1443428181000L // 2015-09-28T08:16:21 UTC val t2: Long = 1443436242000L // 2015-09-28T10:30:42 UTC - val hours = CamusPartitionChecker.hoursInBetween(t1, t2) - val expectedHours = Seq((2015, 9, 28, 9), (2015,9,28,10)) + val hours = CamusPartitionChecker.finishedHoursInBetween(t1, t2) + val expectedHours = Seq((2015, 9, 28, 8), (2015, 9, 28, 9)) hours should equal (expectedHours) } - "A CamusChecker" should "find hours no hours in between wrong timestamps" in { + "A CamusChecker" should "find hours no hours in between inversed timestamps" in { val t1: Long = 1443428181000L // 2015-09-28T10:16:21 val t2: Long = 1443436242000L // 2015-09-28T12:30:42 - val hoursEmpty = CamusPartitionChecker.hoursInBetween(t2, t1) + val hoursEmpty = CamusPartitionChecker.finishedHoursInBetween(t2, t1) hoursEmpty should equal (Seq.empty) } -- To view, visit https://gerrit.wikimedia.org/r/249368 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3b43e735faa629b8923ce142da2d456039d0853a Gerrit-PatchSet: 1 Gerrit-Project: analytics/refinery/source Gerrit-Branch: master Gerrit-Owner: Joal <j...@wikimedia.org> Gerrit-Reviewer: Nuria <nu...@wikimedia.org> Gerrit-Reviewer: Ottomata <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits