embulk-executor-mapreduce 0.1.3 → 0.1.4

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: dc83806412506bc567037cdf24a1c247a99abf13
4
- data.tar.gz: 10a3dd696c3729f58a0c4e2b0ec5b0217cbdfcc1
3
+ metadata.gz: 3f93e6df3aba9f8ca575092d4a3878abe484a452
4
+ data.tar.gz: d42c206f46d13885733f6e048eb4249b22ed7d29
5
5
  SHA512:
6
- metadata.gz: f4ef4b1809a3acf01d0cf449efd4bc026fc77e60bd3aba8708102b0118c06a4b5a7bfd06ce70f497d0121da86ddfe9012dc20ab152c0c192ba0dad1eb80065be
7
- data.tar.gz: 0999ab7bc7eb9fa1e71e61212c6be680c9e5fa232ea1cd4d57f45a8e7228e41ea4d4ee8c1e794de64b5caf77232264126979560fe09988bb55d264bfa2839e70
6
+ metadata.gz: 0f250d3cd401e52c149eac498a3549d25240c1f5091cca170aab53d95432a8463d77aacc1c9b33a3a3bd95005970186b511a7c60bbf03a1b0cf8c62ca54b7ab6
7
+ data.tar.gz: 43f8de24c547fdf4eb004e15a4bee6164401d7a4abefa79a1fa5f62ec7696279b9fe7ae80eab1d25f39104d1331d64c58ade74d19117dc6fa06f421843062eaa
Binary file
Binary file
@@ -5,6 +5,8 @@ import java.util.ArrayList;
5
5
  import java.util.concurrent.Callable;
6
6
  import java.util.concurrent.ExecutionException;
7
7
  import java.io.File;
8
+ import java.io.InputStream;
9
+ import java.io.ByteArrayInputStream;
8
10
  import java.io.IOException;
9
11
  import java.io.EOFException;
10
12
  import java.io.InterruptedIOException;
@@ -48,6 +50,7 @@ import org.embulk.spi.util.RetryExecutor.RetryGiveupException;
48
50
  import org.embulk.EmbulkService;
49
51
  import org.slf4j.Logger;
50
52
 
53
+ import static java.nio.charset.StandardCharsets.UTF_8;
51
54
  import static org.embulk.spi.util.RetryExecutor.retryExecutor;
52
55
 
53
56
  public class EmbulkMapReduce
@@ -71,8 +74,10 @@ public class EmbulkMapReduce
71
74
  {
72
75
  try {
73
76
  ModelManager bootstrapModelManager = new ModelManager(null, new ObjectMapper());
74
- return new ConfigLoader(bootstrapModelManager).fromJson(
75
- new JsonFactory().createParser(config.get(CK_SYSTEM_CONFIG))); // TODO add fromJson(String)
77
+ String json = config.get(CK_SYSTEM_CONFIG);
78
+ try (InputStream in = new ByteArrayInputStream(json.getBytes(UTF_8))) {
79
+ return new ConfigLoader(bootstrapModelManager).fromJson(in);
80
+ }
76
81
  } catch (IOException e) {
77
82
  throw Throwables.propagate(e);
78
83
  }
@@ -324,7 +329,12 @@ public class EmbulkMapReduce
324
329
 
325
330
  private static <T> T hadoopOperationWithRetry(final String message, final Callable<T> callable) throws IOException
326
331
  {
327
- final Logger log = Exec.getLogger(EmbulkMapReduce.class);
332
+ return hadoopOperationWithRetry(Exec.getLogger(EmbulkMapReduce.class), message, callable);
333
+ }
334
+
335
+ private static <T> T hadoopOperationWithRetry(final Logger log,
336
+ final String message, final Callable<T> callable) throws IOException
337
+ {
328
338
  try {
329
339
  return retryExecutor()
330
340
  .withRetryLimit(5)
@@ -379,7 +389,7 @@ public class EmbulkMapReduce
379
389
  this.injector = newEmbulkInstance(context.getConfiguration());
380
390
  this.modelManager = injector.getInstance(ModelManager.class);
381
391
  this.task = getExecutorTask(injector, context.getConfiguration());
382
- this.session = new ExecSession(injector, task.getExecConfig());
392
+ this.session = ExecSession.builder(injector).fromExecConfig(task.getExecConfig()).build();
383
393
 
384
394
  try {
385
395
  LocalDirAllocator localDirAllocator = new LocalDirAllocator(MRConfig.LOCAL_DIR);
@@ -505,11 +515,18 @@ public class EmbulkMapReduce
505
515
  private SessionRunner runner;
506
516
 
507
517
  @Override
508
- public void setup(Context context) throws IOException
518
+ public void setup(Context context) throws IOException, InterruptedException
509
519
  {
510
520
  this.context = context;
511
521
  this.runner = new SessionRunner(context);
512
- runner.readPluginArchive().restoreLoadPathsTo(runner.getScriptingContainer());
522
+
523
+ runner.execSession(new ExecAction<Void>() { // for Exec.getLogger
524
+ public Void run() throws IOException
525
+ {
526
+ runner.readPluginArchive().restoreLoadPathsTo(runner.getScriptingContainer());
527
+ return null;
528
+ }
529
+ });
513
530
  }
514
531
 
515
532
  @Override
@@ -45,11 +45,18 @@ public class EmbulkPartitioningMapReduce
45
45
  private SessionRunner runner;
46
46
 
47
47
  @Override
48
- public void setup(Context context) throws IOException
48
+ public void setup(Context context) throws IOException, InterruptedException
49
49
  {
50
50
  this.context = context;
51
51
  this.runner = new SessionRunner(context);
52
- runner.readPluginArchive().restoreLoadPathsTo(runner.getScriptingContainer());
52
+
53
+ runner.execSession(new ExecAction<Void>() { // for Exec.getLogger
54
+ public Void run() throws IOException
55
+ {
56
+ runner.readPluginArchive().restoreLoadPathsTo(runner.getScriptingContainer());
57
+ return null;
58
+ }
59
+ });
53
60
  }
54
61
 
55
62
  @Override
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-executor-mapreduce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Executes tasks on Hadoop.
14
14
  email:
@@ -60,7 +60,7 @@ files:
60
60
  - classpath/curator-client-2.6.0.jar
61
61
  - classpath/curator-framework-2.6.0.jar
62
62
  - classpath/curator-recipes-2.6.0.jar
63
- - classpath/embulk-executor-mapreduce-0.1.3.jar
63
+ - classpath/embulk-executor-mapreduce-0.1.4.jar
64
64
  - classpath/gson-2.2.4.jar
65
65
  - classpath/hadoop-annotations-2.6.0.jar
66
66
  - classpath/hadoop-auth-2.6.0.jar
@@ -96,10 +96,12 @@ files:
96
96
  - classpath/jline-0.9.94.jar
97
97
  - classpath/jsr305-1.3.9.jar
98
98
  - classpath/leveldbjni-all-1.8.jar
99
+ - classpath/log4j-1.2.17.jar
99
100
  - classpath/netty-3.7.0.Final.jar
100
101
  - classpath/paranamer-2.3.jar
101
102
  - classpath/protobuf-java-2.5.0.jar
102
103
  - classpath/servlet-api-2.5.jar
104
+ - classpath/slf4j-log4j12-1.7.5.jar
103
105
  - classpath/snappy-java-1.0.4.1.jar
104
106
  - classpath/stax-api-1.0-2.jar
105
107
  - classpath/xmlenc-0.52.jar