Skip to content

Commit

Permalink
Loader: improvements to initialization logs and monitoring (close #1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Sep 2, 2022
1 parent 8071ad5 commit 8e774e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,18 @@ object Loader {
val periodicMetrics: Stream[F, Unit] =
Monitoring[F].periodicMetrics.report

val init: F[Unit] = TargetCheck.blockUntilReady[F, C](config.readyCheck, config.storage) *>
NoOperation.prepare(config.schedules.noOperation, control.makePaused) *>
Manifest.initialize[F, C](config.storage) *>
Transaction[F, C].transact(addLoadTstampColumn[C](config.storage))

val initWithRetry: F[Unit] = retryingOnAllErrors(Retry.getRetryPolicy[F](config.initRetries), initRetryLog[F])(init)

val process = Stream.eval(initWithRetry).flatMap { _ =>
val blockUntilReady = TargetCheck.blockUntilReady[F, C](config.readyCheck, config.storage) *>
Logging[F].info("Target check is completed")
val noOperationPrepare = NoOperation.prepare(config.schedules.noOperation, control.makePaused) *>
Logging[F].info("No operation prepare step is completed")
val manifestInit = retryingOnAllErrors(Retry.getRetryPolicy[F](config.initRetries), initRetryLog[F])(Manifest.initialize[F, C](config.storage)) *>
Logging[F].info("Manifest initialization is completed")
val addLoadTstamp = Transaction[F, C].transact(addLoadTstampColumn[C](config.storage)) *>
Logging[F].info("Adding load_tstamp column is completed")

val init: F[Unit] = blockUntilReady *> noOperationPrepare *> manifestInit *> addLoadTstamp

val process = Stream.eval(init).flatMap { _ =>
loading
.merge(folderMonitoring)
.merge(noOpScheduling)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object Manifest {
s"The new manifest table has been created, legacy 0.1.0 manifest can be found at $LegacyName and can be deleted manually"
)
case Right(InitStatus.NoChanges) =>
Monad[F].unit
Logging[F].info("No changes needed on the manifest table")
case Left(error) =>
Logging[F].error(error)("Fatal error has happened during manifest table initialization") *>
MonadError[F, Throwable].raiseError(new IllegalStateException(error.toString))
Expand Down

0 comments on commit 8e774e3

Please sign in to comment.