Skip to content

Commit 23f2096

Browse files
committed
Test object becomes a case class
1 parent 01c3f01 commit 23f2096

File tree

14 files changed

+163
-83
lines changed

14 files changed

+163
-83
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Overview
66

77

8-
Version: 1.0.19
8+
Version: 1.0.20
99

1010
API Scaladoc: [SparkHelper](http://xavierguihot.com/spark_helper/#com.spark_helper.SparkHelper$)
1111

@@ -131,7 +131,7 @@ With sbt, add these lines to your build.sbt:
131131
```scala
132132
resolvers += "jitpack" at "https://jitpack.io"
133133

134-
libraryDependencies += "com.github.xavierguihot" % "spark_helper" % "v1.0.19"
134+
libraryDependencies += "com.github.xavierguihot" % "spark_helper" % "v1.0.20"
135135
```
136136

137137
With maven, add these lines to your pom.xml:
@@ -147,7 +147,7 @@ With maven, add these lines to your pom.xml:
147147
<dependency>
148148
<groupId>com.github.xavierguihot</groupId>
149149
<artifactId>spark_helper</artifactId>
150-
<version>v1.0.19</version>
150+
<version>v1.0.20</version>
151151
</dependency>
152152
```
153153

@@ -161,7 +161,7 @@ allprojects {
161161
}
162162
163163
dependencies {
164-
compile 'com.github.xavierguihot:spark_helper:v1.0.19'
164+
compile 'com.github.xavierguihot:spark_helper:v1.0.20'
165165
}
166166
```
167167

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name := "spark_helper"
22

3-
version := "1.0.19"
3+
version := "1.0.20"
44

55
scalaVersion := "2.11.12"
66

docs/com/spark_helper/monitoring/Monitor.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ <h4 id="signature" class="signature">
6565
<span class="cmt">// Let's say you want to get some KPIs on your output before storing it:</span>
6666
<span class="kw">val</span> outputIsValid = monitor.updateByKpisValidation(
6767
<span class="std">List</span>(
68-
<span class="kw">new</span> Test(<span class="lit">"Nbr of output records"</span>, processedData.count(), SUPERIOR_THAN, <span class="num">10</span>e6d, NBR),
69-
<span class="kw">new</span> Test(<span class="lit">"Some pct of invalid output"</span>, your_complex_kpi, INFERIOR_THAN, <span class="num">3</span>, PCT)
68+
Test(<span class="lit">"Nbr of output records"</span>, processedData.count(), SUPERIOR_THAN, <span class="num">10</span>e6d, NBR),
69+
Test(<span class="lit">"Some pct of invalid output"</span>, your_complex_kpi, INFERIOR_THAN, <span class="num">3</span>, PCT)
7070
),
7171
<span class="lit">"My pipeline descirption"</span>
7272
)
@@ -581,7 +581,7 @@ <h4 class="signature">
581581
validation and the success status of the monitoring is set to false if the
582582
KPI isn't valid.</p><p>If the validation is a failure then after that the status will never be
583583
success again, even if you update the report with success tasks.</p><p>Using this method like this:</p><pre>monitor.updateByKpiValidation(
584-
<span class="kw">new</span> Test(<span class="lit">"pctOfWhatever"</span>, <span class="num">0.06</span>d, INFERIOR_THAN, <span class="num">0.1</span>d, PCT),
584+
Test(<span class="lit">"pctOfWhatever"</span>, <span class="num">0.06</span>d, INFERIOR_THAN, <span class="num">0.1</span>d, PCT),
585585
<span class="lit">"Tests for whatever"</span>)</pre><p>will result in this to be appended to the report:</p><pre>[<span class="num">10</span>:<span class="num">35</span>-<span class="num">10</span>:<span class="num">37</span>] Tests <span class="kw">for</span> whatever: success
586586
KPI: pctOfWhatever
587587
Value: <span class="num">0.06</span>%
@@ -609,9 +609,9 @@ <h4 class="signature">
609609
if at least one KPI isn't valid.</p><p>If the validation of tests is a failure then after that the status will
610610
never be success again, even if you update the report with success tasks.</p><p>Using this method like this:</p><pre>monitor.updateByKpisValidation(
611611
<span class="std">List</span>(
612-
<span class="kw">new</span> Test(<span class="lit">"pctOfWhatever"</span>, <span class="num">0.06</span>d, INFERIOR_THAN, <span class="num">0.1</span>d, PCT),
613-
<span class="kw">new</span> Test(<span class="lit">"pctOfSomethingElse"</span>, <span class="num">0.27</span>d, SUPERIOR_THAN, <span class="num">0.3</span>d, PCT),
614-
<span class="kw">new</span> Test(<span class="lit">"someNbr"</span>, <span class="num">1235</span>d, EQUAL_TO, <span class="num">1235</span>d, NBR)
612+
Test(<span class="lit">"pctOfWhatever"</span>, <span class="num">0.06</span>d, INFERIOR_THAN, <span class="num">0.1</span>d, PCT),
613+
Test(<span class="lit">"pctOfSomethingElse"</span>, <span class="num">0.27</span>d, SUPERIOR_THAN, <span class="num">0.3</span>d, PCT),
614+
Test(<span class="lit">"someNbr"</span>, <span class="num">1235</span>d, EQUAL_TO, <span class="num">1235</span>d, NBR)
615615
),
616616
<span class="lit">"Tests for whatever"</span>
617617
)</pre><p>will result in this to be appended to the report:</p><pre>[<span class="num">10</span>:<span class="num">35</span>-<span class="num">10</span>:<span class="num">37</span>] Tests <span class="kw">for</span> whatever: failed

docs/com/spark_helper/monitoring/Test.html

Lines changed: 105 additions & 42 deletions
Large diffs are not rendered by default.

docs/com/spark_helper/monitoring/package.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ <h4 class="signature">
115115
<span class="cmt">// Let's say you want to get some KPIs on your output before storing it:</span>
116116
<span class="kw">val</span> outputIsValid = monitor.updateByKpisValidation(
117117
<span class="std">List</span>(
118-
<span class="kw">new</span> Test(<span class="lit">"Nbr of output records"</span>, processedData.count(), SUPERIOR_THAN, <span class="num">10</span>e6d, NBR),
119-
<span class="kw">new</span> Test(<span class="lit">"Some pct of invalid output"</span>, your_complex_kpi, INFERIOR_THAN, <span class="num">3</span>, PCT)
118+
Test(<span class="lit">"Nbr of output records"</span>, processedData.count(), SUPERIOR_THAN, <span class="num">10</span>e6d, NBR),
119+
Test(<span class="lit">"Some pct of invalid output"</span>, your_complex_kpi, INFERIOR_THAN, <span class="num">3</span>, PCT)
120120
),
121121
<span class="lit">"My pipeline descirption"</span>
122122
)
@@ -193,25 +193,27 @@ <h4 class="signature">
193193
/main/scala/com/spark_helper/monitoring/Monitor.scala">Monitor</a>
194194
</p></div><dl class="attributes block"> <dt>Since</dt><dd><p>2017-02</p></dd></dl></div>
195195
</li><li name="com.spark_helper.monitoring.Test" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
196-
<a id="TestextendsAnyRef"></a>
196+
<a id="TestextendsProductwithSerializable"></a>
197197
<a id="Test:Test"></a>
198198
<h4 class="signature">
199199
<span class="modifier_kind">
200-
<span class="modifier"></span>
201-
<span class="kind">class</span>
200+
<span class="modifier">final </span>
201+
<span class="kind">case class</span>
202202
</span>
203203
<span class="symbol">
204-
<a href="Test.html"><span class="name">Test</span></a><span class="result"> extends <span class="extype" name="scala.AnyRef">AnyRef</span></span>
204+
<a href="Test.html"><span class="name">Test</span></a><span class="params">(<span name="description">description: <span class="extype" name="scala.Predef.String">String</span></span>, <span name="kpiValue">kpiValue: <span class="extype" name="scala.Double">Double</span></span>, <span name="thresholdType">thresholdType: <a href="ThresholdType.html" class="extype" name="com.spark_helper.monitoring.ThresholdType">ThresholdType</a></span>, <span name="appliedThreshold">appliedThreshold: <span class="extype" name="scala.Double">Double</span></span>, <span name="kpiType">kpiType: <a href="KpiType.html" class="extype" name="com.spark_helper.monitoring.KpiType">KpiType</a></span>)</span><span class="result"> extends <span class="extype" name="scala.Product">Product</span> with <span class="extype" name="scala.Serializable">Serializable</span></span>
205205
</span>
206206
</h4><span class="permalink">
207-
<a href="../../../index.html#com.spark_helper.monitoring.package@TestextendsAnyRef" title="Permalink" target="_top">
207+
<a href="../../../index.html#com.spark_helper.monitoring.package@TestextendsProductwithSerializable" title="Permalink" target="_top">
208208
<img src="../../../lib/permalink.png" alt="Permalink" />
209209
</a>
210210
</span>
211211
<p class="shortcomment cmt">A class which represents a KPI to validate.</p><div class="fullcomment"><div class="comment cmt"><p>A class which represents a KPI to validate.</p><p>This is intended to be used as parameter of Monitor.updateByKpiValidation
212-
and Monitor.updateByKpisValidation methods.</p><p>Some exemples of Test objects:</p><pre><span class="kw">new</span> Test(<span class="lit">"pctOfWhatever"</span>, <span class="num">0.06</span>d, INFERIOR_THAN, <span class="num">0.1</span>d, PCT)
213-
<span class="kw">new</span> Test(<span class="lit">"pctOfSomethingElse"</span>, <span class="num">0.27</span>d, SUPERIOR_THAN, <span class="num">0.3</span>d, PCT)
214-
<span class="kw">new</span> Test(<span class="lit">"someNbr"</span>, <span class="num">1235</span>d, EQUAL_TO, <span class="num">1235</span>d, NBR)</pre></div><dl class="attributes block"> <dt>Since</dt><dd><p>2016-12</p></dd></dl></div>
212+
and Monitor.updateByKpisValidation methods.</p><p>Some exemples of Test objects:</p><pre>Test(<span class="lit">"pctOfWhatever"</span>, <span class="num">0.06</span>d, INFERIOR_THAN, <span class="num">0.1</span>d, PCT)
213+
Test(<span class="lit">"pctOfSomethingElse"</span>, <span class="num">0.27</span>d, SUPERIOR_THAN, <span class="num">0.3</span>d, PCT)
214+
Test(<span class="lit">"someNbr"</span>, <span class="num">1235</span>d, EQUAL_TO, <span class="num">1235</span>d, NBR)</pre></div><dl class="paramcmts block"><dt class="param">description</dt><dd class="cmt"><p>the name/description of the KPI which will appear on the
215+
validation report.</p></dd><dt class="param">kpiValue</dt><dd class="cmt"><p>the value for this KPI</p></dd><dt class="param">thresholdType</dt><dd class="cmt"><p>the type of threshold (SUPERIOR_THAN, INFERIOR_THAN or
216+
EQUAL_TO).</p></dd><dt class="param">appliedThreshold</dt><dd class="cmt"><p>the threshold to apply</p></dd><dt class="param">kpiType</dt><dd class="cmt"><p>the type of KPI (PCT or NBR)</p></dd></dl><dl class="attributes block"> <dt>Since</dt><dd><p>2016-12</p></dd></dl></div>
215217
</li><li name="com.spark_helper.monitoring.ThresholdType" visbl="pub" data-isabs="true" fullComment="no" group="Ungrouped">
216218
<a id="ThresholdTypeextendsAnyRef"></a>
217219
<a id="ThresholdType:ThresholdType"></a>

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<ol class="templates"><li title="com.spark_helper.DateHelper"><a class="tplshow" href="com/spark_helper/DateHelper$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">DateHelper</span></a></li><li title="com.spark_helper.HdfsHelper"><a class="tplshow" href="com/spark_helper/HdfsHelper$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">HdfsHelper</span></a></li><li title="com.spark_helper.SparkHelper"><a class="tplshow" href="com/spark_helper/SparkHelper$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">SparkHelper</span></a></li></ol>
3939
<ol class="packages"> <li class="pack" title="com.spark_helper.monitoring">
4040
<a class="tplshow" href="com/spark_helper/monitoring/package.html" target="template">com.spark_helper.monitoring</a>
41-
<ol class="templates"><li title="com.spark_helper.monitoring.EQUAL_TO"><a class="tplshow" href="com/spark_helper/monitoring/EQUAL_TO$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">EQUAL_TO</span></a></li><li title="com.spark_helper.monitoring.INFERIOR_THAN"><a class="tplshow" href="com/spark_helper/monitoring/INFERIOR_THAN$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">INFERIOR_THAN</span></a></li><li title="com.spark_helper.monitoring.KpiType"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/KpiType.html" target="template"><span class="trait">(trait)</span><span class="tplLink">KpiType</span></a></li><li title="com.spark_helper.monitoring.Monitor"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/Monitor.html" target="template"><span class="class">(class)</span><span class="tplLink">Monitor</span></a></li><li title="com.spark_helper.monitoring.NBR"><a class="tplshow" href="com/spark_helper/monitoring/NBR$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">NBR</span></a></li><li title="com.spark_helper.monitoring.PCT"><a class="tplshow" href="com/spark_helper/monitoring/PCT$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">PCT</span></a></li><li title="com.spark_helper.monitoring.SUPERIOR_THAN"><a class="tplshow" href="com/spark_helper/monitoring/SUPERIOR_THAN$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">SUPERIOR_THAN</span></a></li><li title="com.spark_helper.monitoring.Test"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/Test.html" target="template"><span class="class">(class)</span><span class="tplLink">Test</span></a></li><li title="com.spark_helper.monitoring.ThresholdType"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/ThresholdType.html" target="template"><span class="trait">(trait)</span><span class="tplLink">ThresholdType</span></a></li></ol>
41+
<ol class="templates"><li title="com.spark_helper.monitoring.EQUAL_TO"><a class="tplshow" href="com/spark_helper/monitoring/EQUAL_TO$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">EQUAL_TO</span></a></li><li title="com.spark_helper.monitoring.INFERIOR_THAN"><a class="tplshow" href="com/spark_helper/monitoring/INFERIOR_THAN$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">INFERIOR_THAN</span></a></li><li title="com.spark_helper.monitoring.KpiType"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/KpiType.html" target="template"><span class="trait">(trait)</span><span class="tplLink">KpiType</span></a></li><li title="com.spark_helper.monitoring.Monitor"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/Monitor.html" target="template"><span class="class">(class)</span><span class="tplLink">Monitor</span></a></li><li title="com.spark_helper.monitoring.NBR"><a class="tplshow" href="com/spark_helper/monitoring/NBR$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">NBR</span></a></li><li title="com.spark_helper.monitoring.PCT"><a class="tplshow" href="com/spark_helper/monitoring/PCT$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">PCT</span></a></li><li title="com.spark_helper.monitoring.SUPERIOR_THAN"><a class="tplshow" href="com/spark_helper/monitoring/SUPERIOR_THAN$.html" target="template"><span class="object">(object)</span><div class="placeholder"></div><span class="tplLink">SUPERIOR_THAN</span></a></li><li title="com.spark_helper.monitoring.Test"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/Test.html" target="template"><span class="case class">(case class)</span><span class="tplLink">Test</span></a></li><li title="com.spark_helper.monitoring.ThresholdType"><div class="placeholder"></div><a class="tplshow" href="com/spark_helper/monitoring/ThresholdType.html" target="template"><span class="trait">(trait)</span><span class="tplLink">ThresholdType</span></a></li></ol>
4242
<ol class="packages"> </ol>
4343
</li></ol>
4444
</li></ol>

docs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index/index-a.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
</div><div class="entry">
2020
<div class="name">appendHeaderAndFooter</div>
2121
<div class="occurrences"><a href="../com/spark_helper/HdfsHelper$.html" class="extype" name="com.spark_helper.HdfsHelper">HdfsHelper</a> </div>
22+
</div><div class="entry">
23+
<div class="name">appliedThreshold</div>
24+
<div class="occurrences"><a href="../com/spark_helper/monitoring/Test.html" class="extype" name="com.spark_helper.monitoring.Test">Test</a> </div>
2225
</div></body>
2326
</html>

docs/index/index-d.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@
3131
</div><div class="entry">
3232
<div class="name">deleteFolder</div>
3333
<div class="occurrences"><a href="../com/spark_helper/HdfsHelper$.html" class="extype" name="com.spark_helper.HdfsHelper">HdfsHelper</a> </div>
34+
</div><div class="entry">
35+
<div class="name">description</div>
36+
<div class="occurrences"><a href="../com/spark_helper/monitoring/Test.html" class="extype" name="com.spark_helper.monitoring.Test">Test</a> </div>
3437
</div></body>
3538
</html>

docs/index/index-k.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@
1313
<body><div class="entry">
1414
<div class="name">KpiType</div>
1515
<div class="occurrences"><a href="../com/spark_helper/monitoring/package.html" class="extype" name="com.spark_helper.monitoring">monitoring</a> </div>
16+
</div><div class="entry">
17+
<div class="name">kpiType</div>
18+
<div class="occurrences"><a href="../com/spark_helper/monitoring/Test.html" class="extype" name="com.spark_helper.monitoring.Test">Test</a> </div>
19+
</div><div class="entry">
20+
<div class="name">kpiValue</div>
21+
<div class="occurrences"><a href="../com/spark_helper/monitoring/Test.html" class="extype" name="com.spark_helper.monitoring.Test">Test</a> </div>
1622
</div></body>
1723
</html>

0 commit comments

Comments
 (0)