From efb7e3c28f8b28775d9463f5f3b7b8b866245bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Cio=C5=82ecki?= Date: Thu, 11 May 2023 09:41:04 +0200 Subject: [PATCH] Fix: make getLatestDeployment a public at PeriodicProcessService (#4284) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Ciołecki --- .../periodic/PeriodicProcessService.scala | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessService.scala b/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessService.scala index 8733a21ca4a..cc0fb7224cb 100644 --- a/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessService.scala +++ b/engine/flink/management/periodic/src/main/scala/pl/touk/nussknacker/engine/management/periodic/PeriodicProcessService.scala @@ -350,21 +350,22 @@ class PeriodicProcessService(delegateDeploymentManager: DeploymentManager, } } - /** - * Returns latest deployment. It can be in any status (consult [[PeriodicProcessDeploymentStatus]]). - * For multiple schedules only single schedule is returned in the following order: - *
    - *
  1. If there are any deployed scenarios, then the first one is returned. Please be aware that deployment of previous - * schedule could fail.
  2. - *
  3. If there are any failed scenarios, then the last one is returned. We want to inform user, that some deployments - * failed and the scenario should be rescheduled/retried manually. - *
  4. If there are any scheduled scenarios, then the first one to be run is returned. - *
  5. If there are any finished scenarios, then the last one is returned. It should not happen because the scenario - * should be deactivated earlier. - *
- */ - private[periodic] def getLatestDeployment(processName: ProcessName): Future[Option[PeriodicProcessDeployment]] = { + * @Important: this method has to be public because it can be used by dedicated process manager + * + * Returns latest deployment. It can be in any status (consult [[PeriodicProcessDeploymentStatus]]). + * For multiple schedules only single schedule is returned in the following order: + *
    + *
  1. If there are any deployed scenarios, then the first one is returned. Please be aware that deployment of previous + * schedule could fail.
  2. + *
  3. If there are any failed scenarios, then the last one is returned. We want to inform user, that some deployments + * failed and the scenario should be rescheduled/retried manually. + *
  4. If there are any scheduled scenarios, then the first one to be run is returned. + *
  5. If there are any finished scenarios, then the last one is returned. It should not happen because the scenario + * should be deactivated earlier. + *
+ */ + def getLatestDeployment(processName: ProcessName): Future[Option[PeriodicProcessDeployment]] = { scheduledProcessesRepository.getLatestDeploymentForEachSchedule(processName) .map(_.sortBy(_.runAt)).run .map { deployments => @@ -383,4 +384,4 @@ class PeriodicProcessService(delegateDeploymentManager: DeploymentManager, } } -} \ No newline at end of file +}