-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#495 Add operation definitions to the task results object used in not…
…ifications.
- Loading branch information
Showing
74 changed files
with
686 additions
and
291 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
pramen/api/src/main/scala/za/co/absa/pramen/api/jobdef/Schedule.scala
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.jobdef | ||
|
||
import java.time.{DayOfWeek, LocalDate} | ||
|
||
sealed trait Schedule { | ||
def isEnabled(day: LocalDate): Boolean | ||
} | ||
|
||
object Schedule { | ||
case object Incremental extends Schedule { | ||
def isEnabled(day: LocalDate): Boolean = true | ||
|
||
override def toString: String = "incremental" | ||
} | ||
|
||
case class EveryDay() extends Schedule { | ||
def isEnabled(day: LocalDate): Boolean = true | ||
|
||
override def toString: String = "daily" | ||
} | ||
|
||
case class Weekly(days: Seq[DayOfWeek]) extends Schedule { | ||
def isEnabled(day: LocalDate): Boolean = days.contains(day.getDayOfWeek) | ||
|
||
override def toString: String = s"weekly (${days.mkString(", ")})" | ||
} | ||
|
||
case class Monthly(days: Seq[Int]) extends Schedule { | ||
val hasPositiveDays: Boolean = days.exists(_ > 0) | ||
val hasNegativeDays: Boolean = days.exists(_ < 0) | ||
|
||
def isEnabled(day: LocalDate): Boolean = { | ||
val isInPositives = hasPositiveDays && days.contains(day.getDayOfMonth) | ||
val isInNegatives = hasNegativeDays && days.contains(-day.lengthOfMonth() + day.getDayOfMonth - 1) | ||
isInPositives || isInNegatives | ||
} | ||
|
||
override def toString: String = s"monthly (${days.mkString(", ")})" | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
pramen/api/src/main/scala/za/co/absa/pramen/api/jobdef/SinkTable.scala
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.jobdef | ||
|
||
import com.typesafe.config.Config | ||
|
||
case class SinkTable( | ||
metaTableName: String, | ||
outputTableName: Option[String], | ||
conf: Config, | ||
rangeFromExpr: Option[String], | ||
rangeToExpr: Option[String], | ||
warnMaxExecutionTimeSeconds: Option[Int], | ||
transformations: Seq[TransformExpression], | ||
filters: Seq[String], | ||
columns: Seq[String], | ||
options: Map[String, String], | ||
overrideConf: Option[Config] | ||
) |
33 changes: 33 additions & 0 deletions
33
pramen/api/src/main/scala/za/co/absa/pramen/api/jobdef/SourceTable.scala
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.jobdef | ||
|
||
import com.typesafe.config.Config | ||
import za.co.absa.pramen.api.Query | ||
|
||
case class SourceTable( | ||
metaTableName: String, | ||
query: Query, | ||
conf: Config, | ||
rangeFromExpr: Option[String], | ||
rangeToExpr: Option[String], | ||
warnMaxExecutionTimeSeconds: Option[Int], | ||
transformations: Seq[TransformExpression], | ||
filters: Seq[String], | ||
columns: Seq[String], | ||
overrideConf: Option[Config] | ||
) |
42 changes: 42 additions & 0 deletions
42
pramen/api/src/main/scala/za/co/absa/pramen/api/jobdef/TransferTable.scala
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.jobdef | ||
|
||
import com.typesafe.config.Config | ||
import za.co.absa.pramen.api.{DataFormat, Query} | ||
|
||
import java.time.LocalDate | ||
|
||
case class TransferTable( | ||
query: Query, | ||
jobMetaTableName: String, | ||
conf: Config, | ||
rangeFromExpr: Option[String], | ||
rangeToExpr: Option[String], | ||
infoDateStart: LocalDate, | ||
trackDays: Int, | ||
trackDaysExplicitlySet: Boolean, | ||
warnMaxExecutionTimeSeconds: Option[Int], | ||
transformations: Seq[TransformExpression], | ||
filters: Seq[String], | ||
columns: Seq[String], | ||
readOptions: Map[String, String], | ||
writeOptions: Map[String, String], | ||
sparkConfig: Map[String, String], | ||
sourceOverrideConf: Option[Config], | ||
sinkOverrideConf: Option[Config] | ||
) |
23 changes: 23 additions & 0 deletions
23
pramen/api/src/main/scala/za/co/absa/pramen/api/jobdef/TransformExpression.scala
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.jobdef | ||
|
||
case class TransformExpression( | ||
column: String, | ||
expression: Option[String], | ||
comment: Option[String] | ||
) |
64 changes: 64 additions & 0 deletions
64
pramen/api/src/main/scala/za/co/absa/pramen/api/status/JobType.scala
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.status | ||
|
||
import com.typesafe.config.Config | ||
import za.co.absa.pramen.api.jobdef.{SinkTable, SourceTable, TransferTable} | ||
|
||
sealed trait JobType { | ||
def name: String | ||
} | ||
|
||
object JobType { | ||
case class Ingestion( | ||
sourceName: String, | ||
sourceTable: SourceTable, | ||
sourceConfig: Config | ||
) extends JobType { | ||
override def name: String = "ingestion" | ||
} | ||
|
||
case class Transformation( | ||
factoryClass: String | ||
) extends JobType { | ||
override def name: String = "transformation" | ||
} | ||
|
||
case class PythonTransformation( | ||
pythonClass: String | ||
) extends JobType { | ||
override def name: String = "python_transformation" | ||
} | ||
|
||
case class Sink( | ||
sinkName: String, | ||
sinkTable: SinkTable, | ||
sinkConfig: Config | ||
) extends JobType { | ||
override def name: String = "sink" | ||
} | ||
|
||
case class Transfer( | ||
sourceName: String, | ||
sourceConfig: Config, | ||
sinkName: String, | ||
sinkConfig: Config, | ||
transferTable: TransferTable | ||
) extends JobType { | ||
override def name: String = "transfer" | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
pramen/api/src/main/scala/za/co/absa/pramen/api/status/TaskDef.scala
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2022 ABSA Group Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package za.co.absa.pramen.api.status | ||
|
||
import com.typesafe.config.Config | ||
import za.co.absa.pramen.api.MetaTableDef | ||
import za.co.absa.pramen.api.jobdef.Schedule | ||
|
||
case class TaskDef( | ||
name: String, | ||
jobType: JobType, | ||
outputTable: MetaTableDef, | ||
schedule: Schedule, | ||
operationConf: Config | ||
) |
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
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.