-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#105: Refactoring Measurement, from Agent side #104
Merged
Merged
Changes from 38 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
7b013f9
Refactoring Measurement and a lot of stuff from Agent side
lsulak 0b3b5b4
Better validation handling - Set for measurements and measures as the…
lsulak e9b771d
Merge branch 'master' into feature/measurement-refactoring
lsulak bb72f40
Merge branch 'master' into feature/measurement-refactoring
lsulak fe62225
Merge branch 'master' into feature/measurement-refactoring
lsulak 6a299b6
Merge branch 'master' into feature/measurement-refactoring
lsulak a6bc965
Merge remote-tracking branch 'origin/master' into feature/measurement…
lsulak 093c6e0
post-merge fix, set can't be understood by the fa-db
lsulak 8e68cf1
Merge remote-tracking branch 'origin/master' into feature/measurement…
lsulak 7a0b52e
fixing the build, after merge conflict resolution
lsulak 5f1c422
Tiny doc improvement
lsulak bce5d81
Merge remote-tracking branch 'origin/master' into feature/measurement…
lsulak 3a2b928
doc update, post-merge
lsulak 9f82011
doc update, post-merge
lsulak ebf6731
Merge branch 'master' into feature/measurement-refactoring
lsulak b2c9aa2
Merge remote-tracking branch 'origin/master' into feature/measurement…
lsulak 0a5e2ad
post-merge fixes
lsulak 2ab9fd5
post-merge fixes
lsulak fe918df
post-merge fixes
lsulak c1efab2
post-merge fixes (still not finished completely)
lsulak f1be1a8
ControlCols -> MeasuredCols, refactoring and tests
lsulak 64da68a
consistency with DTO
lsulak 21b2454
yet more refactoring, this is cleaner (I'll consider using Shapeless)
lsulak f6c916d
removing basically redundant code
lsulak bd53781
anti-pattern removal & removal of useless parameter for the Record Count
lsulak 62eb239
post-review comments
lsulak c5190d2
post-review comments
lsulak 8a92e94
post-review changes
lsulak 1805a53
Merge remote-tracking branch 'origin/master' into feature/measurement…
lsulak d85c85e
post-merge fixes
lsulak a80956a
post-merge fixes
lsulak fcfe3fb
#105: refactoring to have a generic type of the measurement result
lsulak cae400d
Merge branch 'master' into feature/measurement-refactoring
lsulak 23ff72b
Merge branch 'master' into feature/measurement-refactoring
lsulak e6df0d7
Merge branch 'master' into feature/measurement-refactoring
lsulak bdf8906
Merge branch 'master' into feature/measurement-refactoring
lsulak 8beceef
Merge branch 'master' into feature/measurement-refactoring
lsulak 830be6e
#105: dropping Measurement in agent and thus simplifying the code eve…
lsulak 098d40b
#105: changing Enumeration to case objects for easier SerDe in the fu…
lsulak 6d838d7
fix
lsulak 79a0bed
Merge branch 'master' into feature/measurement-refactoring
lsulak 4a34b7f
#105: getSimpleName is using reflection, and reflection in Java 8 and…
lsulak 98d10e0
Merge branch 'master' into feature/measurement-refactoring
lsulak 595a972
Merge branch 'master' into feature/measurement-refactoring
lsulak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ package za.co.absa.atum.agent | |
|
||
import org.apache.spark.sql.DataFrame | ||
import za.co.absa.atum.agent.AtumContext.AtumPartitions | ||
import za.co.absa.atum.agent.model.Measurement.MeasurementByAtum | ||
import za.co.absa.atum.agent.model._ | ||
import za.co.absa.atum.model.dto._ | ||
|
||
|
@@ -56,10 +55,11 @@ class AtumContext private[agent] ( | |
agent.getOrCreateAtumSubContext(atumPartitions ++ subPartitions)(this) | ||
} | ||
|
||
private def takeMeasurements(df: DataFrame): Set[MeasurementByAtum] = { | ||
private def takeMeasurements(df: DataFrame): Set[MeasurementDTO] = { | ||
measures.map { m => | ||
val measurementResult = m.function(df) | ||
MeasurementByAtum(m, measurementResult.result, measurementResult.resultType) | ||
// TODO group measurements together: https://github.com/AbsaOSS/atum-service/issues/98 | ||
val measureResult = m.function(df) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIny: (do only in any reasonable change is needed too) |
||
MeasurementBuilder.buildMeasurementDTO(m, measureResult) | ||
} | ||
} | ||
|
||
|
@@ -78,7 +78,7 @@ class AtumContext private[agent] ( | |
*/ | ||
def createCheckpoint(checkpointName: String, dataToMeasure: DataFrame): AtumContext = { | ||
val startTime = ZonedDateTime.now() | ||
val measurements = takeMeasurements(dataToMeasure) | ||
val measurementDTOs = takeMeasurements(dataToMeasure) | ||
val endTime = ZonedDateTime.now() | ||
|
||
val checkpointDTO = CheckpointDTO( | ||
|
@@ -89,7 +89,7 @@ class AtumContext private[agent] ( | |
partitioning = AtumPartitions.toSeqPartitionDTO(this.atumPartitions), | ||
processStartTime = startTime, | ||
processEndTime = Some(endTime), | ||
measurements = measurements.map(MeasurementBuilder.buildMeasurementDTO).toSeq | ||
measurements = measurementDTOs | ||
) | ||
|
||
agent.saveCheckpoint(checkpointDTO) | ||
|
@@ -103,7 +103,7 @@ class AtumContext private[agent] ( | |
* @param measurements the measurements to be included in the checkpoint | ||
* @return the AtumContext after the checkpoint has been created | ||
*/ | ||
def createCheckpointOnProvidedData(checkpointName: String, measurements: Seq[Measurement]): AtumContext = { | ||
def createCheckpointOnProvidedData(checkpointName: String, measurements: Map[AtumMeasure, MeasureResult]): AtumContext = { | ||
val dateTimeNow = ZonedDateTime.now() | ||
|
||
val checkpointDTO = CheckpointDTO( | ||
|
@@ -113,7 +113,7 @@ class AtumContext private[agent] ( | |
partitioning = AtumPartitions.toSeqPartitionDTO(this.atumPartitions), | ||
processStartTime = dateTimeNow, | ||
processEndTime = Some(dateTimeNow), | ||
measurements = measurements.map(MeasurementBuilder.buildMeasurementDTO) | ||
measurements = MeasurementBuilder.buildAndValidateMeasurementsDTO(measurements) | ||
) | ||
|
||
agent.saveCheckpoint(checkpointDTO) | ||
|
@@ -154,7 +154,7 @@ class AtumContext private[agent] ( | |
/** | ||
* Adds a measure to the AtumContext. | ||
* | ||
* @param measure the measure to be added | ||
* @param newMeasure the measure to be added | ||
*/ | ||
def addMeasure(newMeasure: AtumMeasure): AtumContext = { | ||
measures = measures + newMeasure | ||
|
@@ -164,7 +164,7 @@ class AtumContext private[agent] ( | |
/** | ||
* Adds multiple measures to the AtumContext. | ||
* | ||
* @param measures set sequence of measures to be added | ||
* @param newMeasures set sequence of measures to be added | ||
*/ | ||
def addMeasures(newMeasures: Set[AtumMeasure]): AtumContext = { | ||
measures = measures ++ newMeasures | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.scala-lang.org/style/scaladoc.html