-
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
#25: create class for partitions #45
Conversation
import java.time.LocalDate | ||
import scala.collection.immutable.ListMap | ||
|
||
case class AtumPartitions(name: String, reportDate: LocalDate, partitions: Partitions = ListMap()) { |
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.
name
and reportDate
are surplus. There are no specific keys always present, so these while to be expected to be common, should be part of the partitons key.
import java.time.LocalDate | ||
import scala.collection.immutable.ListMap | ||
|
||
case class AtumPartitions(name: String, reportDate: LocalDate, partitions: Partitions = ListMap()) { |
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.
This class is kind of a key toe AtumContext
definitely should be a member of the class.
* @return | ||
*/ | ||
def createAtumContext(atumPartitions: AtumPartitions): AtumContext = { | ||
AtumContext() |
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.
This would need more logic. According to my insight, the returned value should be a kind of singleton of AtumContext
. For same atumPartitions
the same AtumContext
needs to be returned.
From that POV I am even considering making AtumContext
mutable in the regard of Measures
. What do you think guys? @seldon851, @Zejnilovic, @dk1844 , @lsulak, @jakipatryk, @yruslan
JaCoCo agent module code coverage report - spark:2 - scala 2.12.12
|
JaCoCo server module code coverage report - scala 2.12.12
|
) | ||
|
||
/** | ||
* Sends a single `MeasureResult` to the AtumService API. With not AtumContext involve. |
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.
* Sends a single `MeasureResult` to the AtumService API. With not AtumContext involve. | |
* Sends a single `MeasureResult` to the AtumService API. Without AtumContext involve. |
* `AtumAgent` now a class and companion object of the class to allow referencing * `AtumContext` now behaves somewhat like a singleton for given `AtumPartitions` - as a result it's mutable * Rename `Measurement` to `Measure` * Simplified `AtumPartitions`
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.
LGTM so far, no big issues, just minor
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
agent/src/main/scala/za/co/absa/atum/agent/model/AtumPartitions.scala
Outdated
Show resolved
Hide resolved
* deleted obsolete class
…reate-class-4-segmentation-2
val result = MeasureResult(measure, measure.function(df)) | ||
AtumAgent.publish(checkpointName, atumContext, result) | ||
|
||
executeMeasures(checkpointName, atumContext.measurements) | ||
executeMeasures(checkpointName, atumContext.measures) |
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.
this line can be removed, it's doing the same as the whole foreach basically
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.
Will removed, but as said, this needs reword. createCheckpoint
and send it as an "atomic" steo.
* @param measure the measure to be calculated | ||
* @return | ||
*/ | ||
def executeMeasure(checkpointName: String, measure: Measurement): DataFrame = { | ||
|
||
def executeMeasure(checkpointName: String, measure: Measure): DataFrame = { |
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.
I think that execute should do only executing and publishing should do publishing. And it can be all put together in some other operation.
I definitely wouldn't expect from 'executeMeasure' to actually also send data to the server
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.
I think these could and should be eventually completely removed. Thee;s no scenario where just particular measure are recorded for a checkpoint.
@@ -78,11 +109,11 @@ object AtumContext { | |||
* @return | |||
*/ | |||
def createCheckpoint(checkpointName: String)(implicit atumContext: AtumContext): DataFrame = { | |||
atumContext.measurements.foreach { measure => | |||
atumContext.measures.foreach { measure => | |||
val result = MeasureResult(measure, measure.function(df)) |
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.
here you can call executeMeasure
function.
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.
As it will (probably) go away, can this stay? 😉
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.
Approved. Obviously the code is a bit chaotic with the current implementation versus what we want to achieve - we can build something on top of this, but rework a lot. Let's merge it and deal with it later (but soon)
AtumContext
of sub-partitionsAtumAgent
now a class and companion object of the class to allow referencingAtumContext
now behaves somewhat like a singleton for givenAtumPartitions
- as a result it's mutableMeasurement
toMeasure
AtumPartitions
Closes #25
Closes #33