embulk-filter-speedometer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/build.gradle +13 -3
- data/classpath/{embulk-filter-speedometer-0.2.1.jar → embulk-filter-speedometer-0.2.2.jar} +0 -0
- data/src/main/java/org/embulk/filter/SpeedometerFilterPlugin.java +1 -1
- data/src/main/java/org/embulk/filter/SpeedometerUtil.java +13 -0
- data/src/test/java/org/embulk/filter/TestSpeedometerUtil.java +21 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 525cd955adc5782203cdf6b18247a06bb735b85b
|
4
|
+
data.tar.gz: 2cac362870f2fd022ce61a1b564ffef59ac2762a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 526d22cc15e2be5f2732852b9519f6a0647553e03b73da7e2d9d984613dc98410ac33135a95044d263583eabf1db8f2cefe61ca6a36ea615a3e25d193777c095
|
7
|
+
data.tar.gz: e4b9921f9b9573022bce814128fc0b436a9736639acfc4b1318cfad66ce53a900b73836a16a97a6c992f5adaf56d8226d16efd2d1cfa0fcde21a62a996e9748d
|
data/README.md
CHANGED
@@ -72,6 +72,6 @@ $ ./gradlew gem
|
|
72
72
|
|
73
73
|
## Note
|
74
74
|
|
75
|
-
The shown data is caled based on text data size while using this filter plugin. So, the data is not the same data as read bytes and write bytes n input and output plugins.
|
75
|
+
The shown data is caled based on text data size while using this filter plugin. So, the data is not the same data as read bytes and write bytes n input and output plugins. And this plugin has a little overhead to measure the bytes.
|
76
76
|
|
77
77
|
|
data/build.gradle
CHANGED
@@ -16,7 +16,7 @@ configurations {
|
|
16
16
|
provided
|
17
17
|
}
|
18
18
|
|
19
|
-
version = "0.2.
|
19
|
+
version = "0.2.2"
|
20
20
|
|
21
21
|
dependencies {
|
22
22
|
compile "org.embulk:embulk-core:0.5.0+"
|
@@ -39,13 +39,23 @@ task gem(type: JRubyExec, dependsOn: ["build", "gemspec", "classpath"]) {
|
|
39
39
|
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
|
40
40
|
}
|
41
41
|
|
42
|
+
task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
|
43
|
+
jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
|
44
|
+
script "pkg/${project.name}-${project.version}.gem"
|
45
|
+
}
|
46
|
+
|
47
|
+
task "package"(dependsOn: ["gemspec", "classpath"]) << {
|
48
|
+
println "> Build succeeded."
|
49
|
+
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
|
50
|
+
}
|
51
|
+
|
42
52
|
task gemspec << { file("build/gemspec").write($/
|
43
53
|
Gem::Specification.new do |spec|
|
44
54
|
spec.name = "${project.name}"
|
45
55
|
spec.version = "${project.version}"
|
46
|
-
spec.authors = ["
|
56
|
+
spec.authors = ["hata"]
|
47
57
|
spec.summary = %[Speedometer filter plugin for Embulk]
|
48
|
-
spec.description = %[
|
58
|
+
spec.description = %[Write log message of processed bytes and throughput periodically.]
|
49
59
|
spec.email = ["hiroki.ata@gmail.com"]
|
50
60
|
spec.licenses = ["MIT"]
|
51
61
|
spec.homepage = "https://github.com/hata/embulk-filter-speedometer"
|
Binary file
|
@@ -256,7 +256,7 @@ public class SpeedometerFilterPlugin
|
|
256
256
|
|
257
257
|
private long speedMonitor(Column column, long l) {
|
258
258
|
speedMonitorForDelimiter(column);
|
259
|
-
controller.checkSpeedLimit(startRecordTime,
|
259
|
+
controller.checkSpeedLimit(startRecordTime, SpeedometerUtil.toDigitsTextLength(l));
|
260
260
|
return l;
|
261
261
|
}
|
262
262
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
package org.embulk.filter;
|
2
2
|
|
3
3
|
public class SpeedometerUtil {
|
4
|
+
private static final int MIN_LENGTH = String.valueOf(Long.MIN_VALUE).length();
|
4
5
|
|
5
6
|
public static String toNumberText(long originalNum) {
|
6
7
|
long baseNum = 1000;
|
@@ -60,4 +61,16 @@ public class SpeedometerUtil {
|
|
60
61
|
|
61
62
|
return String.format("%1d days", num);
|
62
63
|
}
|
64
|
+
|
65
|
+
public static int toDigitsTextLength(long num) {
|
66
|
+
if (num == 0) {
|
67
|
+
return 1;
|
68
|
+
} else if (num == Long.MIN_VALUE) {
|
69
|
+
return MIN_LENGTH;
|
70
|
+
} else if (num < 0) {
|
71
|
+
return 2 + (int)Math.log10(Math.abs(num)); // Note: minus(-) is added.
|
72
|
+
} else {
|
73
|
+
return 1 + (int)Math.log10(num);
|
74
|
+
}
|
75
|
+
}
|
63
76
|
}
|
@@ -38,4 +38,25 @@ public class TestSpeedometerUtil {
|
|
38
38
|
assertEquals("Verify 100 days", "100 days", SpeedometerUtil.toTimeText(60L * 60 * 24 * 1000 * 100));
|
39
39
|
}
|
40
40
|
|
41
|
+
@Test
|
42
|
+
public void testToNumberLengthForZero() {
|
43
|
+
assertEquals("Verify toNumberText to zero", 1, SpeedometerUtil.toDigitsTextLength(0));
|
44
|
+
}
|
45
|
+
|
46
|
+
@Test
|
47
|
+
public void testToNumberLengthForMax() {
|
48
|
+
assertEquals("Verify toNumberText to max", String.valueOf(Long.MAX_VALUE).length(), SpeedometerUtil.toDigitsTextLength(Long.MAX_VALUE));
|
49
|
+
}
|
50
|
+
|
51
|
+
@Test
|
52
|
+
public void testToNumberLengthForMin() {
|
53
|
+
assertEquals("Verify toNumberText to min", String.valueOf(Long.MIN_VALUE).length(), SpeedometerUtil.toDigitsTextLength(Long.MIN_VALUE));
|
54
|
+
}
|
55
|
+
|
56
|
+
@Test
|
57
|
+
public void testToNumberLengthForSeveralValues() {
|
58
|
+
for (int i = -1024;i < 1024;i++) {
|
59
|
+
assertEquals("Verify toNumberText to " + i, String.valueOf(i).length(), SpeedometerUtil.toDigitsTextLength(i));
|
60
|
+
}
|
61
|
+
}
|
41
62
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-filter-speedometer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- hata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
version: '10.0'
|
39
39
|
prerelease: false
|
40
40
|
type: :development
|
41
|
-
description:
|
41
|
+
description: Write log message of processed bytes and throughput periodically.
|
42
42
|
email:
|
43
43
|
- hiroki.ata@gmail.com
|
44
44
|
executables: []
|
@@ -62,7 +62,7 @@ files:
|
|
62
62
|
- src/test/java/org/embulk/filter/TestSpeedometerSpeedAggregator.java
|
63
63
|
- src/test/java/org/embulk/filter/TestSpeedometerSpeedController.java
|
64
64
|
- src/test/java/org/embulk/filter/TestSpeedometerUtil.java
|
65
|
-
- classpath/embulk-filter-speedometer-0.2.
|
65
|
+
- classpath/embulk-filter-speedometer-0.2.2.jar
|
66
66
|
homepage: https://github.com/hata/embulk-filter-speedometer
|
67
67
|
licenses:
|
68
68
|
- MIT
|