embulk-output-s3_per_record 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/build.gradle +1 -1
- data/src/main/java/org/embulk/output/s3_per_record/S3PerRecordOutputPlugin.java +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59291fd824e6db4a6f56e4e3b107f1be43a71dfa
|
4
|
+
data.tar.gz: 0cb03ee9ae9d61130c53c5a0f5b80e5bd4ae34d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c446fa5ddc162c53763695e8b36d5ca6ec213d5e677ecf5df0fe31097e5aae445ae34176642dcdfbe51b05085d5fc82d771a1572588386c9587c22c9f3b2b8a
|
7
|
+
data.tar.gz: 7c7e563beeede3252e82ed481a9e4bba1785bf4e6f1abfb508d602041a8ad37df6db7a6f5d6b61ba78c042274d2a8b5abc13a3423f75edda8cdbbe4c05624220
|
data/.gitignore
CHANGED
data/build.gradle
CHANGED
@@ -6,6 +6,7 @@ import java.io.InputStream;
|
|
6
6
|
import java.nio.charset.StandardCharsets;
|
7
7
|
import java.util.ArrayList;
|
8
8
|
import java.util.List;
|
9
|
+
import java.util.concurrent.atomic.AtomicLong;
|
9
10
|
|
10
11
|
import javax.validation.constraints.NotNull;
|
11
12
|
|
@@ -32,6 +33,7 @@ import com.amazonaws.services.s3.transfer.TransferManager;
|
|
32
33
|
import com.amazonaws.services.s3.transfer.Upload;
|
33
34
|
import com.amazonaws.util.Base64;
|
34
35
|
import com.google.common.base.Optional;
|
36
|
+
import org.slf4j.Logger;
|
35
37
|
|
36
38
|
|
37
39
|
public class S3PerRecordOutputPlugin
|
@@ -41,6 +43,11 @@ public class S3PerRecordOutputPlugin
|
|
41
43
|
public static final String KEY_COLUMN_START_MARKER = "${";
|
42
44
|
public static final String KEY_COLUMN_END_MARKER = "}";
|
43
45
|
|
46
|
+
private static final Logger logger = Exec.getLogger(S3PerRecordOutputPlugin.class);
|
47
|
+
private static volatile long nextLoggingRowCount = 1000;
|
48
|
+
private static AtomicLong processedRows = new AtomicLong(0);
|
49
|
+
private static long startTime = System.currentTimeMillis();
|
50
|
+
|
44
51
|
public interface PluginTask
|
45
52
|
extends Task
|
46
53
|
{
|
@@ -129,6 +136,7 @@ public class S3PerRecordOutputPlugin
|
|
129
136
|
credentials = new DefaultAWSCredentialsProviderChain().getCredentials();
|
130
137
|
}
|
131
138
|
transferManager = new TransferManager(credentials);
|
139
|
+
logger.info("Start Upload to bucket \"{}\"", bucket);
|
132
140
|
}
|
133
141
|
|
134
142
|
private List<KeyPart> makeKeyPattern(final String key) {
|
@@ -175,6 +183,12 @@ public class S3PerRecordOutputPlugin
|
|
175
183
|
try (InputStream is = new ByteArrayInputStream(payloadBytes)) {
|
176
184
|
Upload upload = transferManager.upload(bucket, key, is, metadata);
|
177
185
|
upload.waitForUploadResult();
|
186
|
+
long rows = processedRows.incrementAndGet();
|
187
|
+
if (rows == nextLoggingRowCount) {
|
188
|
+
double seconds = (System.currentTimeMillis() - startTime) / 1000.0;
|
189
|
+
logger.info(String.format("> Uploaded %,d rows in %.2f seconds", rows, seconds));
|
190
|
+
nextLoggingRowCount *= 2;
|
191
|
+
}
|
178
192
|
} catch (InterruptedException | IOException e) {
|
179
193
|
throw new RuntimeException(e);
|
180
194
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-s3_per_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tomykaira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -63,8 +63,8 @@ files:
|
|
63
63
|
- classpath/commons-logging-1.1.3.jar
|
64
64
|
- classpath/commons-codec-1.6.jar
|
65
65
|
- classpath/aws-java-sdk-s3-1.10.71.jar
|
66
|
-
- classpath/embulk-output-s3_per_record-0.1.2.jar
|
67
66
|
- classpath/aws-java-sdk-core-1.10.71.jar
|
67
|
+
- classpath/embulk-output-s3_per_record-0.2.0.jar
|
68
68
|
- classpath/httpcore-4.3.3.jar
|
69
69
|
- classpath/aws-java-sdk-kms-1.10.71.jar
|
70
70
|
homepage: https://github.com/tomykaira/embulk-output-s3_per_record
|