Skip to content

Commit

Permalink
Fix logs for the schema validation job (#5157)
Browse files Browse the repository at this point in the history
* Fix logs for the schema validation job

---------

Co-authored-by: Simon Dumas <[email protected]>
  • Loading branch information
imsdu and Simon Dumas authored Sep 30, 2024
1 parent 1531189 commit d241d12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object SchemaValidationCoordinator {
private val logger = Logger[SchemaValidationCoordinator]

def projectionMetadata(project: ProjectRef): ProjectionMetadata =
ProjectionMetadata("schema", s"schema-$project-validate-resources", Some(project), None)
ProjectionMetadata("schema", s"schema-validate-resources-$project", Some(project), None)

def apply(supervisor: Supervisor, schemaValidationStream: SchemaValidationStream): SchemaValidationCoordinator =
new SchemaValidationCoordinator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,18 @@ object SchemaValidationStream {
}
} yield (Some(()))

private def log(message: String) = Stream.eval(logger.info(message))

override def apply(project: ProjectRef, offset: Offset): ElemStream[Unit] = {
for {
_ <- log(s"Starting validation of resources for project '$project'")
stream <- resourceStream(project, offset).evalMap {
_.evalMapFilter {
case r if r.deprecated => IO.none
case r if r.schema.iri == schemas.resources => IO.none
case r => validateSingle(r)
}
}
_ <- log(s"Validation of resources for project '$project' has been completed.")
} yield stream

}
override def apply(project: ProjectRef, offset: Offset): ElemStream[Unit] =
Stream.eval(logger.info(s"Starting validation of resources for project '$project'")) >>
resourceStream(project, offset)
.evalMap {
_.evalMapFilter {
case r if r.deprecated => IO.none
case r if r.schema.iri == schemas.resources => IO.none
case r => validateSingle(r)
}
}
.onFinalize {
logger.info(s"Validation of resources for project '$project' has been completed.")
}
}
}

0 comments on commit d241d12

Please sign in to comment.