Skip to content

Commit

Permalink
RDB Loader: deprecate steps (close #625)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Dec 1, 2021
1 parent 324c671 commit bda93a4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 0 additions & 4 deletions config/loader.config.reference.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
"maxError": 10
},

# Additional steps. analyze, vacuum and transit_load are valid values
# Optional, default value []
"steps": ["analyze"],

# Observability and reporting options
"monitoring": {
# Snowplow tracking (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ object Main extends IOApp {
val folderMonitoring: Stream[F, Unit] =
FolderMonitoring.run[F](cli.config.monitoring.folders, cli.config.storage, control.isBusy)

// TODO: Currently, steps are deactivated with making them empty.
// Remove them from the codebase properly.
Stream.eval_(Manifest.initialize[F](cli.config.storage)) ++
DataDiscovery
.discover[F](cli.config, control.state)
.discover[F](cli.config.copy(steps = Set.empty), control.state)
.pauseWhen[F](control.isBusy)
.evalMap { discovery =>
val prepare = for {
Expand All @@ -75,7 +77,7 @@ object Main extends IOApp {
} yield ()

val loading: F[Unit] = prepare.use { _ =>
load[F](cli.config, control.state.setStage, discovery).rethrowT *> control.state.update(_.incrementLoaded)
load[F](cli.config.copy(steps = Set.empty), control.state.setStage, discovery).rethrowT *> control.state.update(_.incrementLoaded)
}

// Catches both connection acquisition and loading errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object ConfigSpec {
10,
None
)
val exampleSteps: Set[Step] = Set(Step.Analyze)
val exampleSteps: Set[Step] = Set()

def getConfig[A](confPath: String, parse: String => EitherT[IO, String, A]): Either[String, A] =
parse(readResource(confPath)).value.unsafeRunSync()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class LoadSpec extends Specification {
LogEntry.Sql(Statement.Commit)
)

val result = Load.load[Pure](SpecHelpers.validCliConfig.config, LoadSpec.setStageNoOp, message).value.runS
val result = Load.load[Pure](SpecHelpers.validCliConfig.config.copy(steps = Set(Step.Analyze)), LoadSpec.setStageNoOp, message).value.runS

result.getLog must beEqualTo(expected)
}
Expand Down Expand Up @@ -96,7 +96,7 @@ class LoadSpec extends Specification {
LogEntry.Sql(Statement.Commit)
)

val result = Load.load[Pure](SpecHelpers.validCliConfig.config, LoadSpec.setStageNoOp, message).value.runS
val result = Load.load[Pure](SpecHelpers.validCliConfig.config.copy(steps = Set(Step.Analyze)), LoadSpec.setStageNoOp, message).value.runS

result.getLog must beEqualTo(expected)
}
Expand Down Expand Up @@ -158,7 +158,7 @@ class LoadSpec extends Specification {
LogEntry.Sql(Statement.Analyze("atomic.com_acme_json_context_1")),
LogEntry.Sql(Statement.Commit)
)
val result = Load.load[Pure](SpecHelpers.validCliConfig.config, LoadSpec.setStageNoOp, message).value.runS
val result = Load.load[Pure](SpecHelpers.validCliConfig.config.copy(steps = Set(Step.Analyze)), LoadSpec.setStageNoOp, message).value.runS

result.getLog must beEqualTo(expected)
}
Expand Down

0 comments on commit bda93a4

Please sign in to comment.