diff --git a/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/BaseSpec.scala b/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/BaseSpec.scala index 7006eab98..0caa37a0e 100644 --- a/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/BaseSpec.scala +++ b/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/BaseSpec.scala @@ -20,7 +20,7 @@ class BaseSpec extends FlatSpec with Matchers with BeforeAndAfterAll with Mockit override def beforeAll() { if (embeddedCassandraMode) { System.setProperty("cassandra.unsafesystem", "true") - EmbeddedCassandraServerHelper.startEmbeddedCassandra(20000L) + EmbeddedCassandraServerHelper.startEmbeddedCassandra(30000L) val session = DBUtil.session val dataLoader = new CQLDataLoader(session); dataLoader.load(new FileCQLDataSet(AppConf.getConfig("cassandra.cql_path"), true, true)); diff --git a/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala b/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala index 6ee62235d..a8a27ba89 100644 --- a/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala +++ b/platform-api/analytics-api-core/src/test/scala/org/ekstep/analytics/api/util/TestCommonUtil.scala @@ -1,5 +1,6 @@ package org.ekstep.analytics.api.util +import org.ekstep.analytics.api.util.CommonUtil.monthPeriod import org.ekstep.analytics.api.{BaseSpec, Range, ResponseCode} import org.joda.time.format.{DateTimeFormat, DateTimeFormatter} import org.joda.time.{DateTime, DateTimeZone, Duration} @@ -14,7 +15,7 @@ class TestCommonUtil extends BaseSpec { val thisYear: Int = (new DateTime).getYear val thisMonth: Int = (new DateTime).getMonthOfYear val thisWeekNo = (new DateTime).getWeekOfWeekyear - val monthYear = Integer.parseInt(s"$thisYear"+s"$thisMonth") + val monthYear = monthPeriod.print(new DateTime).toInt val now = DateTime.now(DateTimeZone.UTC) val dateInt = Integer.parseInt(dateFormat.print(now).replace("-", "")) @@ -32,7 +33,8 @@ class TestCommonUtil extends BaseSpec { resp3.params.status should be("successful"); resp3.result.get should be(Map("ttl" -> 24.asInstanceOf[AnyRef])); CommonUtil.getDayRange(7) should be(Range(Integer.parseInt(dateFormat.print(now.minusDays(7)).replace("-", "")), dateInt)) - CommonUtil.getMonthRange(2) should be(Range(monthYear-2, monthYear)) + val startMonth = monthPeriod.print((new DateTime).minusMonths(2)).toInt + CommonUtil.getMonthRange(2) should be(Range(startMonth, monthYear)) CommonUtil.getRemainingHours() should be(remainingTime) CommonUtil.getWeeksBetween(1451650400000L, 1454650400000L) should be(5); diff --git a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/AssessmentMetricsJob.scala b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/AssessmentMetricsJob.scala index df3dcee80..67b701216 100644 --- a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/AssessmentMetricsJob.scala +++ b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/AssessmentMetricsJob.scala @@ -26,6 +26,7 @@ object AssessmentMetricsJob extends optional.Application with IJob with BaseRepo def main(config: String)(implicit sc: Option[SparkContext] = None, fc: Option[FrameworkContext] = None) { + JobLogger.init("Assessment Metrics") JobLogger.start("Assessment Job Started executing", Option(Map("config" -> config, "model" -> name))) val jobConfig = JSONUtils.deserialize[JobConfig](config) @@ -281,6 +282,7 @@ object AssessmentMetricsJob extends optional.Application with IJob with BaseRepo FileUtil.renameReport(tempDir, renamedDir, batchId) val storageService = getReportStorageService(); storageService.upload(container, renamedDir, objectKey, isDirectory = Option(true)) + storageService.closeContext() } def saveToElastic(index: String, reportDF: DataFrame): Unit = { diff --git a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/CourseMetricsJob.scala b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/CourseMetricsJob.scala index 1d7dfaadc..18e9a3e65 100644 --- a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/CourseMetricsJob.scala +++ b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/CourseMetricsJob.scala @@ -337,6 +337,7 @@ object CourseMetricsJob extends optional.Application with IJob with ReportGenera val objectKey = AppConf.getConfig("course.metrics.cloud.objectKey") val storageService = getReportStorageService(); storageService.upload(container, sourcePath, objectKey, isDirectory = Option(true)) + storageService.closeContext() } private def recursiveListFiles(file: File, ext: String): Array[File] = { diff --git a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminGeoReportJob.scala b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminGeoReportJob.scala index 4c0b80f86..105590f4d 100644 --- a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminGeoReportJob.scala +++ b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminGeoReportJob.scala @@ -106,6 +106,7 @@ object StateAdminGeoReportJob extends optional.Application with IJob with StateA val storageService = getReportStorageService(); storageService.upload(container, sourcePath, objectKey, isDirectory = Option(true)) + storageService.closeContext() } } diff --git a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminReportJob.scala b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminReportJob.scala index 548873970..3fde394c2 100644 --- a/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminReportJob.scala +++ b/platform-modules/batch-models/src/main/scala/org/ekstep/analytics/job/report/StateAdminReportJob.scala @@ -254,6 +254,7 @@ object StateAdminReportJob extends optional.Application with IJob with StateAdmi val storageService = getReportStorageService(); storageService.upload(container, sourcePath, objectKey, isDirectory = Option(true)) + storageService.closeContext() } def dataFrameToJsonFile(dataFrame: DataFrame)(implicit fc: FrameworkContext): Unit = {