embulk-output-aerospike 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13abe937c76a27f33bc023971f909464cbcb616b
|
4
|
+
data.tar.gz: 3ad97e3420a42ca3de5af08b1d2c2586d3ad67b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f36b928015f69e3af871a52fdecfdbbd0d688ebb3d1143c2e8d8f1e7dca9d27467991c16349daebb24c4abc8c0805ef6727a8840ad0b91c300fed39a031c24
|
7
|
+
data.tar.gz: 94f0b593e7c7e926ba85a613723e1bf95fba2c6d0812bd4e4efee2890848b881dd92ac7df5a39f1a0b4815ac124ff4173019852be89a8f01308ded40a2881d20
|
data/build.gradle
CHANGED
@@ -98,8 +98,7 @@ class AerospikeOutputPlugin extends OutputPlugin {
|
|
98
98
|
|
99
99
|
def transaction(config: ConfigSource, schema: Schema, taskCount: Int, control: Control): ConfigDiff = {
|
100
100
|
val task = config.loadConfig(classOf[PluginTask])
|
101
|
-
control.run(task.dump)
|
102
|
-
Exec.newConfigDiff
|
101
|
+
control.run(task.dump).foldRight(Exec.newConfigDiff) { (l, r) => r.merge(l) }
|
103
102
|
}
|
104
103
|
|
105
104
|
def resume(taskSource: TaskSource, schema: Schema, taskCount: Int, control: Control): ConfigDiff =
|
@@ -4,7 +4,7 @@ import java.util.concurrent.atomic.AtomicLong
|
|
4
4
|
|
5
5
|
import aerospiker._
|
6
6
|
import aerospiker.policy.{ ClientPolicy, WritePolicy }
|
7
|
-
import aerospiker.task.Aerospike
|
7
|
+
import aerospiker.task.{ DeleteError, PutError, Aerospike }
|
8
8
|
import cats.data.Xor, Xor._
|
9
9
|
import io.circe._, io.circe.syntax._
|
10
10
|
import org.embulk.config.TaskReport
|
@@ -13,6 +13,7 @@ import org.embulk.spi._
|
|
13
13
|
import org.embulk.spi.`type`.Type
|
14
14
|
import org.embulk.spi.time.Timestamp
|
15
15
|
|
16
|
+
import scala.collection.concurrent.TrieMap
|
16
17
|
import scala.collection.mutable.{ Map => MMap, ListBuffer }
|
17
18
|
import scala.collection.JavaConversions._
|
18
19
|
import scalaz.concurrent.Task
|
@@ -28,6 +29,7 @@ class AerospikePageOutput(taskSource: TaskSource, schema: Schema, taskIndex: Int
|
|
28
29
|
private[this] val tsk = taskSource.loadTask(classOf[AerospikeOutputPlugin.PluginTask])
|
29
30
|
private[this] val successCount = new AtomicLong
|
30
31
|
private[this] val failCount = new AtomicLong
|
32
|
+
private[this] val failures = TrieMap.empty[String, String]
|
31
33
|
|
32
34
|
private[this] val wp: WritePolicy = {
|
33
35
|
if (tsk.getWritePolicy.isPresent) {
|
@@ -146,8 +148,13 @@ class AerospikePageOutput(taskSource: TaskSource, schema: Schema, taskIndex: Int
|
|
146
148
|
Task.delay {
|
147
149
|
for ( r <- t ) {
|
148
150
|
r match {
|
151
|
+
case Left(e @ PutError(key, cause)) =>
|
152
|
+
log.error(e.toString, e)
|
153
|
+
failures += key -> cause.getMessage
|
154
|
+
failCount.addAndGet(1L)
|
149
155
|
case Left(e) =>
|
150
156
|
log.error(e.toString, e)
|
157
|
+
failures += e.getMessage -> e.getMessage
|
151
158
|
failCount.addAndGet(1L)
|
152
159
|
case Right(_) =>
|
153
160
|
successCount.addAndGet(1L)
|
@@ -167,8 +174,9 @@ class AerospikePageOutput(taskSource: TaskSource, schema: Schema, taskIndex: Int
|
|
167
174
|
Task.delay {
|
168
175
|
for ( r <- t ) {
|
169
176
|
r match {
|
170
|
-
case Left(
|
171
|
-
log.error(
|
177
|
+
case Left(DeleteError(key, cause)) =>
|
178
|
+
log.error(key, cause)
|
179
|
+
failures += key -> cause.getMessage
|
172
180
|
failCount.addAndGet(1L)
|
173
181
|
case Right(_) =>
|
174
182
|
successCount.addAndGet(1L)
|
@@ -195,7 +203,12 @@ class AerospikePageOutput(taskSource: TaskSource, schema: Schema, taskIndex: Int
|
|
195
203
|
|
196
204
|
def abort(): Unit = log.error(s"abort ${tsk.getCommand} ok[${successCount.longValue}] ng[${failCount.longValue()}]")
|
197
205
|
|
198
|
-
def commit: TaskReport =
|
206
|
+
def commit: TaskReport = {
|
207
|
+
var r = Exec.newTaskReport
|
208
|
+
r.set("rans", successCount.longValue() + failCount.longValue())
|
209
|
+
r.set("failures", failures.toMap.asJson.pretty(Printer.noSpaces))
|
210
|
+
r
|
211
|
+
}
|
199
212
|
}
|
200
213
|
|
201
214
|
object ops {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-aerospike
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeru Sato
|
@@ -77,7 +77,7 @@ files:
|
|
77
77
|
- classpath/circe-jawn_2.11-0.1.1.jar
|
78
78
|
- classpath/commons-math3-3.2.jar
|
79
79
|
- classpath/discipline_2.11-0.3.jar
|
80
|
-
- classpath/embulk-output-aerospike-0.3.
|
80
|
+
- classpath/embulk-output-aerospike-0.3.1.jar
|
81
81
|
- classpath/gnu-crypto-2.0.1.jar
|
82
82
|
- classpath/jawn-parser_2.11-0.8.0.jar
|
83
83
|
- classpath/jbcrypt-0.3m.jar
|