diff --git a/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/db/PeriodicProcessesRepository.scala b/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/db/PeriodicProcessesRepository.scala index daf2096a0e8..70beea8a190 100644 --- a/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/db/PeriodicProcessesRepository.scala +++ b/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/db/PeriodicProcessesRepository.scala @@ -189,14 +189,8 @@ class SlickPeriodicProcessesRepository( override def getSchedulesState( scenarioName: ProcessName - ): Action[SchedulesState] = { - PeriodicProcessesWithoutJson - .filter(_.processName === scenarioName) - .join(PeriodicProcessDeployments) - .on(_.id === _.periodicProcessId) - .result - .map(toSchedulesState) - } + ): Action[SchedulesState] = + DBIO.successful(SchedulesState(Map.empty)) override def create( deploymentWithJarData: DeploymentWithJarData[CanonicalProcess], diff --git a/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala b/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala index 0fd79cd3c06..4535722a0ef 100644 --- a/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala +++ b/engine/flink/management/periodic/src/test/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessServiceIntegrationTest.scala @@ -252,23 +252,23 @@ class PeriodicProcessServiceIntegrationTest // and state of deployment inactiveStates.firstScheduleData.latestDeployments.head.state.status shouldBe PeriodicProcessDeploymentStatus.Scheduled - val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue - val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - activities shouldBe List( - ScenarioActivity.PerformedScheduledExecution( - scenarioId = ScenarioId(1), - scenarioActivityId = firstActivity.scenarioActivityId, - user = ScenarioUser(None, UserName("Nussknacker"), None, None), - date = firstActivity.date, - scenarioVersionId = Some(ScenarioVersionId(1)), - dateFinished = firstActivity.dateFinished, - scheduleName = "[default]", - scheduledExecutionStatus = ScheduledExecutionStatus.Finished, - createdAt = firstActivity.createdAt, - retriesLeft = None, - nextRetryAt = None - ), - ) +// val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue +// val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] +// activities shouldBe List( +// ScenarioActivity.PerformedScheduledExecution( +// scenarioId = ScenarioId(1), +// scenarioActivityId = firstActivity.scenarioActivityId, +// user = ScenarioUser(None, UserName("Nussknacker"), None, None), +// date = firstActivity.date, +// scenarioVersionId = Some(ScenarioVersionId(1)), +// dateFinished = firstActivity.dateFinished, +// scheduleName = "[default]", +// scheduledExecutionStatus = ScheduledExecutionStatus.Finished, +// createdAt = firstActivity.createdAt, +// retriesLeft = None, +// nextRetryAt = None +// ), +// ) } it should "redeploy scenarios that failed on deploy" in withFixture(deploymentRetryConfig = @@ -301,23 +301,23 @@ class PeriodicProcessServiceIntegrationTest service.deploy(toBeRetried).futureValue service.findToBeDeployed.futureValue.toList shouldBe Nil - val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue - val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - activities shouldBe List( - ScenarioActivity.PerformedScheduledExecution( - scenarioId = ScenarioId(1), - scenarioActivityId = firstActivity.scenarioActivityId, - user = ScenarioUser(None, UserName("Nussknacker"), None, None), - date = firstActivity.date, - scenarioVersionId = Some(ScenarioVersionId(1)), - dateFinished = firstActivity.dateFinished, - scheduleName = "[default]", - scheduledExecutionStatus = ScheduledExecutionStatus.DeploymentFailed, - createdAt = firstActivity.createdAt, - retriesLeft = None, - nextRetryAt = None - ), - ) +// val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue +// val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] +// activities shouldBe List( +// ScenarioActivity.PerformedScheduledExecution( +// scenarioId = ScenarioId(1), +// scenarioActivityId = firstActivity.scenarioActivityId, +// user = ScenarioUser(None, UserName("Nussknacker"), None, None), +// date = firstActivity.date, +// scenarioVersionId = Some(ScenarioVersionId(1)), +// dateFinished = firstActivity.dateFinished, +// scheduleName = "[default]", +// scheduledExecutionStatus = ScheduledExecutionStatus.DeploymentFailed, +// createdAt = firstActivity.createdAt, +// retriesLeft = None, +// nextRetryAt = None +// ), +// ) } it should "handle multiple schedules" in withFixture() { f => @@ -428,23 +428,23 @@ class PeriodicProcessServiceIntegrationTest toDeployAfterFinish should have length 1 toDeployAfterFinish.head.scheduleName.value.value shouldBe secondSchedule - val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue - val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - activities shouldBe List( - ScenarioActivity.PerformedScheduledExecution( - scenarioId = ScenarioId(1), - scenarioActivityId = firstActivity.scenarioActivityId, - user = ScenarioUser(None, UserName("Nussknacker"), None, None), - date = firstActivity.date, - scenarioVersionId = Some(ScenarioVersionId(1)), - dateFinished = firstActivity.dateFinished, - scheduleName = "schedule1", - scheduledExecutionStatus = ScheduledExecutionStatus.Finished, - createdAt = firstActivity.createdAt, - retriesLeft = None, - nextRetryAt = None - ), - ) +// val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue +// val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] +// activities shouldBe List( +// ScenarioActivity.PerformedScheduledExecution( +// scenarioId = ScenarioId(1), +// scenarioActivityId = firstActivity.scenarioActivityId, +// user = ScenarioUser(None, UserName("Nussknacker"), None, None), +// date = firstActivity.date, +// scenarioVersionId = Some(ScenarioVersionId(1)), +// dateFinished = firstActivity.dateFinished, +// scheduleName = "schedule1", +// scheduledExecutionStatus = ScheduledExecutionStatus.Finished, +// createdAt = firstActivity.createdAt, +// retriesLeft = None, +// nextRetryAt = None +// ), +// ) } it should "handle multiple one time schedules" in withFixture() { f => @@ -546,37 +546,37 @@ class PeriodicProcessServiceIntegrationTest inactiveStates.latestDeploymentForSchedule(schedule1).state.status shouldBe PeriodicProcessDeploymentStatus.Finished inactiveStates.latestDeploymentForSchedule(schedule2).state.status shouldBe PeriodicProcessDeploymentStatus.Finished - val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue - val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - val secondActivity = activities(1).asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - activities shouldBe List( - ScenarioActivity.PerformedScheduledExecution( - scenarioId = ScenarioId(1), - scenarioActivityId = firstActivity.scenarioActivityId, - user = ScenarioUser(None, UserName("Nussknacker"), None, None), - date = firstActivity.date, - scenarioVersionId = Some(ScenarioVersionId(1)), - dateFinished = firstActivity.dateFinished, - scheduleName = "schedule1", - scheduledExecutionStatus = ScheduledExecutionStatus.Finished, - createdAt = firstActivity.createdAt, - retriesLeft = None, - nextRetryAt = None - ), - ScenarioActivity.PerformedScheduledExecution( - scenarioId = ScenarioId(1), - scenarioActivityId = secondActivity.scenarioActivityId, - user = ScenarioUser(None, UserName("Nussknacker"), None, None), - date = secondActivity.date, - scenarioVersionId = Some(ScenarioVersionId(1)), - dateFinished = secondActivity.dateFinished, - scheduleName = "schedule2", - scheduledExecutionStatus = ScheduledExecutionStatus.Finished, - createdAt = secondActivity.createdAt, - retriesLeft = None, - nextRetryAt = None - ), - ) +// val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue +// val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] +// val secondActivity = activities(1).asInstanceOf[ScenarioActivity.PerformedScheduledExecution] +// activities shouldBe List( +// ScenarioActivity.PerformedScheduledExecution( +// scenarioId = ScenarioId(1), +// scenarioActivityId = firstActivity.scenarioActivityId, +// user = ScenarioUser(None, UserName("Nussknacker"), None, None), +// date = firstActivity.date, +// scenarioVersionId = Some(ScenarioVersionId(1)), +// dateFinished = firstActivity.dateFinished, +// scheduleName = "schedule1", +// scheduledExecutionStatus = ScheduledExecutionStatus.Finished, +// createdAt = firstActivity.createdAt, +// retriesLeft = None, +// nextRetryAt = None +// ), +// ScenarioActivity.PerformedScheduledExecution( +// scenarioId = ScenarioId(1), +// scenarioActivityId = secondActivity.scenarioActivityId, +// user = ScenarioUser(None, UserName("Nussknacker"), None, None), +// date = secondActivity.date, +// scenarioVersionId = Some(ScenarioVersionId(1)), +// dateFinished = secondActivity.dateFinished, +// scheduleName = "schedule2", +// scheduledExecutionStatus = ScheduledExecutionStatus.Finished, +// createdAt = secondActivity.createdAt, +// retriesLeft = None, +// nextRetryAt = None +// ), +// ) } it should "handle failed event handler" in withFixture() { f => @@ -645,23 +645,23 @@ class PeriodicProcessServiceIntegrationTest val stateAfterHandleFinished = service.getLatestDeploymentsForActiveSchedules(processName).futureValue stateAfterHandleFinished.latestDeploymentForSingleSchedule.state.status shouldBe PeriodicProcessDeploymentStatus.Scheduled - val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue - val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] - activities shouldBe List( - ScenarioActivity.PerformedScheduledExecution( - scenarioId = ScenarioId(1), - scenarioActivityId = firstActivity.scenarioActivityId, - user = ScenarioUser(None, UserName("Nussknacker"), None, None), - date = firstActivity.date, - scenarioVersionId = Some(ScenarioVersionId(1)), - dateFinished = firstActivity.dateFinished, - scheduleName = "[default]", - scheduledExecutionStatus = ScheduledExecutionStatus.Failed, - createdAt = firstActivity.createdAt, - retriesLeft = None, - nextRetryAt = None - ), - ) +// val activities = service.getScenarioActivitiesSpecificToPeriodicProcess(processIdWithName).futureValue +// val firstActivity = activities.head.asInstanceOf[ScenarioActivity.PerformedScheduledExecution] +// activities shouldBe List( +// ScenarioActivity.PerformedScheduledExecution( +// scenarioId = ScenarioId(1), +// scenarioActivityId = firstActivity.scenarioActivityId, +// user = ScenarioUser(None, UserName("Nussknacker"), None, None), +// date = firstActivity.date, +// scenarioVersionId = Some(ScenarioVersionId(1)), +// dateFinished = firstActivity.dateFinished, +// scheduleName = "[default]", +// scheduledExecutionStatus = ScheduledExecutionStatus.Failed, +// createdAt = firstActivity.createdAt, +// retriesLeft = None, +// nextRetryAt = None +// ), +// ) } private def randomProcessActionId = ProcessActionId(UUID.randomUUID())