embulk 0.6.9 → 0.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19a42567d7e841a769ba329935d942926a062f66
4
- data.tar.gz: 0bac8733cc4f5028e62865c08193520fce7f9d79
3
+ metadata.gz: 5f9bbe21037e6186e386b39176e66b8336ce8d20
4
+ data.tar.gz: 29fef3403d44ff6dc571d3e3c050efc23f77b770
5
5
  SHA512:
6
- metadata.gz: b74b82f6d740d513cce0eadc365824a78737a2cd40bcac32082ff51f03259cd720140eb7463530b3ffe8d8a7d8601a4d91de889a891760888c4b8ddfe9b4bede
7
- data.tar.gz: 5a77c5eba35a06074289aab700f1351ced771f1f181cf5831d4ccf747692444063be0c32133a8d5bbf5d30fe6e636db398f591898135b351e81aeba7b90bb3db
6
+ metadata.gz: 1481af06ce9c9aa2497ee25ee2c7b4f3be2578acf33e2be01ba06a0727cdc20523af16a4e7bae64658e286b2060e118e6eedd97cec085186843063f5246a6001
7
+ data.tar.gz: a3ab3e1c0e0f8477127dd30c5484210ae09845410ba0a747be942868061a002ad35e27e4deed4b63c6d49bca6477103728bb35378d12ae8363e40b24d8bea94b
@@ -11,7 +11,7 @@ def release_projects = [project(":embulk-core"), project(":embulk-standards")]
11
11
 
12
12
  allprojects {
13
13
  group = 'org.embulk'
14
- version = '0.6.9'
14
+ version = '0.6.10'
15
15
 
16
16
  ext {
17
17
  jrubyVersion = '1.7.19'
@@ -1,6 +1,9 @@
1
1
  package org.embulk.spi;
2
2
 
3
3
  import java.util.List;
4
+ import com.google.common.base.Function;
5
+ import com.google.common.collect.Lists;
6
+ import com.google.common.collect.ImmutableList;
4
7
  import com.fasterxml.jackson.annotation.JsonCreator;
5
8
  import com.fasterxml.jackson.annotation.JsonProperty;
6
9
  import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -8,6 +11,7 @@ import org.embulk.plugin.PluginType;
8
11
  import org.embulk.config.TaskSource;
9
12
  import org.embulk.spi.Schema;
10
13
  import org.embulk.spi.util.Executors;
14
+ import org.embulk.spi.type.TimestampType;
11
15
 
12
16
  public class ProcessTask
13
17
  {
@@ -21,17 +25,16 @@ public class ProcessTask
21
25
  private final Schema executorSchema;
22
26
  private TaskSource executorTaskSource;
23
27
 
24
- @JsonCreator
25
28
  public ProcessTask(
26
- @JsonProperty("inputType") PluginType inputPluginType,
27
- @JsonProperty("outputType") PluginType outputPluginType,
28
- @JsonProperty("filterTypes") List<PluginType> filterPluginTypes,
29
- @JsonProperty("inputTask") TaskSource inputTaskSource,
30
- @JsonProperty("outputTask") TaskSource outputTaskSource,
31
- @JsonProperty("filterTasks") List<TaskSource> filterTaskSources,
32
- @JsonProperty("schemas") List<Schema> schemas,
33
- @JsonProperty("executorSchema") Schema executorSchema,
34
- @JsonProperty("executorTask") TaskSource executorTaskSource)
29
+ PluginType inputPluginType,
30
+ PluginType outputPluginType,
31
+ List<PluginType> filterPluginTypes,
32
+ TaskSource inputTaskSource,
33
+ TaskSource outputTaskSource,
34
+ List<TaskSource> filterTaskSources,
35
+ List<Schema> schemas,
36
+ Schema executorSchema,
37
+ TaskSource executorTaskSource)
35
38
  {
36
39
  this.inputPluginType = inputPluginType;
37
40
  this.outputPluginType = outputPluginType;
@@ -44,6 +47,36 @@ public class ProcessTask
44
47
  this.executorTaskSource = executorTaskSource;
45
48
  }
46
49
 
50
+ // TODO Because TimestampType doesn't store timestamp_format, serializing and deserializing
51
+ // Schema loses timestamp_format information. Here uses SchemaConfig instead to preseve it.
52
+
53
+ @JsonCreator
54
+ ProcessTask(
55
+ @JsonProperty("inputType") PluginType inputPluginType,
56
+ @JsonProperty("outputType") PluginType outputPluginType,
57
+ @JsonProperty("filterTypes") List<PluginType> filterPluginTypes,
58
+ @JsonProperty("inputTask") TaskSource inputTaskSource,
59
+ @JsonProperty("outputTask") TaskSource outputTaskSource,
60
+ @JsonProperty("filterTasks") List<TaskSource> filterTaskSources,
61
+ @JsonProperty("schemas") List<SchemaConfig> schemas,
62
+ @JsonProperty("executorSchema") SchemaConfig executorSchema,
63
+ @JsonProperty("executorTask") TaskSource executorTaskSource)
64
+ {
65
+ this(inputPluginType, outputPluginType, filterPluginTypes,
66
+ inputTaskSource, outputTaskSource, filterTaskSources,
67
+ ImmutableList.copyOf(Lists.transform(schemas,
68
+ new Function<SchemaConfig, Schema>()
69
+ {
70
+ public Schema apply(SchemaConfig s)
71
+ {
72
+ return s.toSchema();
73
+ }
74
+ }
75
+ )),
76
+ executorSchema.toSchema(),
77
+ executorTaskSource);
78
+ }
79
+
47
80
  @JsonProperty("inputType")
48
81
  public PluginType getInputPluginType()
49
82
  {
@@ -80,18 +113,54 @@ public class ProcessTask
80
113
  return filterTaskSources;
81
114
  }
82
115
 
83
- @JsonProperty("schemas")
116
+ @JsonIgnore
84
117
  public List<Schema> getFilterSchemas()
85
118
  {
86
119
  return schemas;
87
120
  }
88
121
 
89
- @JsonProperty("executorSchema")
122
+ @JsonProperty("schemas")
123
+ public List<SchemaConfig> getFilterSchemaConfigs()
124
+ {
125
+ return Lists.transform(schemas,
126
+ new Function<Schema, SchemaConfig>()
127
+ {
128
+ public SchemaConfig apply(Schema schema)
129
+ {
130
+ return schemaToSchemaConfig(schema);
131
+ }
132
+ });
133
+ }
134
+
135
+ @JsonIgnore
90
136
  public Schema getExecutorSchema()
91
137
  {
92
138
  return executorSchema;
93
139
  }
94
140
 
141
+ @JsonProperty("executorSchema")
142
+ SchemaConfig getExecutorSchemaConfig()
143
+ {
144
+ return schemaToSchemaConfig(executorSchema);
145
+ }
146
+
147
+ private static SchemaConfig schemaToSchemaConfig(Schema s)
148
+ {
149
+ return new SchemaConfig(Lists.transform(s.getColumns(),
150
+ new Function<Column, ColumnConfig>()
151
+ {
152
+ public ColumnConfig apply(Column c)
153
+ {
154
+ if (c.getType() instanceof TimestampType) {
155
+ return new ColumnConfig(c.getName(), c.getType(), ((TimestampType) c.getType()).getFormat());
156
+ } else {
157
+ return new ColumnConfig(c.getName(), c.getType(), null);
158
+ }
159
+ }
160
+ }
161
+ ));
162
+ }
163
+
95
164
  @JsonIgnore
96
165
  public Schema getInputSchema()
97
166
  {
@@ -4,6 +4,7 @@ Release Notes
4
4
  .. toctree::
5
5
  :maxdepth: 1
6
6
 
7
+ release/release-0.6.10
7
8
  release/release-0.6.9
8
9
  release/release-0.6.8
9
10
  release/release-0.6.7
@@ -0,0 +1,15 @@
1
+ Release 0.6.10
2
+ ==================================
3
+
4
+ General Changes
5
+ ------------------
6
+
7
+ * PluginRegistry shows loaded plugin name and version to stdout
8
+ * Fixed a problem where ``embulk gem install`` command can't install gems which include a native extension
9
+ * Added ``embulk irb`` subcommand
10
+ * Fixed ``spi.ProcessTask`` serialization to preserve ``timestamp_format`` of a column. This fixes compatibility with embulk-executor-mapreduce.
11
+
12
+
13
+ Release Date
14
+ ------------------
15
+ 2015-05-21
@@ -14,6 +14,10 @@ module Embulk
14
14
  Gem.clear_paths # force rubygems to reload GEM_HOME
15
15
  end
16
16
 
17
+ # Gem.path is called when GemRunner installs a gem with native extension.
18
+ # Running extconf.rb fails without this hack.
19
+ fix_gem_ruby_path
20
+
17
21
  # to make sure org.embulk.jruby.JRubyScriptingModule can require 'embulk/java/bootstrap'
18
22
  $LOAD_PATH << Embulk.home('lib')
19
23
 
@@ -192,6 +196,11 @@ examples:
192
196
  exec(*argv)
193
197
  exit 127
194
198
 
199
+ when :irb
200
+ require 'irb'
201
+ IRB.start
202
+ exit 0
203
+
195
204
  else
196
205
  usage "Unknown subcommand #{subcmd.dump}."
197
206
  end
@@ -339,7 +348,7 @@ examples:
339
348
 
340
349
  def self.home(dir)
341
350
  jar, resource = __FILE__.split("!")
342
- if resource
351
+ if resource && jar =~ /^file:/
343
352
  home = resource.split("/")[0..-3].join("/")
344
353
  "#{jar}!#{home}/#{dir}"
345
354
  else
@@ -361,6 +370,23 @@ examples:
361
370
 
362
371
  private
363
372
 
373
+ def self.fix_gem_ruby_path
374
+ ruby_path = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
375
+ jar, resource = ruby_path.split("!")
376
+
377
+ if resource && jar =~ /^file:/
378
+ # java
379
+ manifest = File.read("#{jar}!/META-INF/MANIFEST.MF") rescue ""
380
+ m = /Main-Class: ([^\r\n]+)/.match(manifest)
381
+ if m && m[1] != "org.jruby.Main"
382
+ # Main-Class is not jruby
383
+ Gem.define_singleton_method(:ruby) do
384
+ "java -cp #{jar_path(jar)} org.jruby.Main"
385
+ end
386
+ end
387
+ end
388
+ end
389
+
364
390
  def self.setup_gem_paths(path)
365
391
  # install bundler gem here & use bundler installed here
366
392
  ENV['GEM_HOME'] = File.expand_path File.join(path, Gem.ruby_engine, RbConfig::CONFIG['ruby_version'])
@@ -6,6 +6,7 @@ module Embulk
6
6
  def initialize(category, search_prefix)
7
7
  @category = category
8
8
  @search_prefix = search_prefix
9
+ @loaded_gems = {}
9
10
  @map = {}
10
11
  end
11
12
 
@@ -34,7 +35,7 @@ module Embulk
34
35
  def search(type)
35
36
  name = "#{@search_prefix}#{type}"
36
37
  begin
37
- require name
38
+ require_and_show name
38
39
  return true
39
40
  rescue LoadError => e
40
41
  # catch LoadError but don't catch ClassNotFoundException
@@ -50,7 +51,7 @@ module Embulk
50
51
 
51
52
  paths = load_path_files.compact.sort # sort to prefer newer version
52
53
  paths.each do |path|
53
- require path
54
+ require_and_show path
54
55
  return true
55
56
  end
56
57
 
@@ -64,7 +65,7 @@ module Embulk
64
65
  specs = specs.sort_by {|spec| spec.version }
65
66
  if spec = specs.last
66
67
  spec.require_paths.each do |lib|
67
- require "#{spec.full_gem_path}/#{lib}/#{name}"
68
+ require_and_show "#{spec.full_gem_path}/#{lib}/#{name}"
68
69
  end
69
70
  return true
70
71
  end
@@ -72,5 +73,20 @@ module Embulk
72
73
 
73
74
  return false
74
75
  end
76
+
77
+ def require_and_show(name)
78
+ require name
79
+ show_loaded_gems
80
+ end
81
+
82
+ def show_loaded_gems
83
+ # TODO use logger
84
+ Gem.loaded_specs.each do |name,spec|
85
+ if !@loaded_gems[name] && name =~ /^embulk/
86
+ puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S.%3N %z")}: Loaded plugin #{name} (#{spec.version})"
87
+ @loaded_gems[name] = true
88
+ end
89
+ end
90
+ end
75
91
  end
76
92
  end
@@ -1,3 +1,3 @@
1
1
  module Embulk
2
- VERSION = '0.6.9'
2
+ VERSION = '0.6.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9
4
+ version: 0.6.10
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-05-15 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -293,6 +293,7 @@ files:
293
293
  - embulk-docs/src/release/release-0.5.5.rst
294
294
  - embulk-docs/src/release/release-0.6.0.rst
295
295
  - embulk-docs/src/release/release-0.6.1.rst
296
+ - embulk-docs/src/release/release-0.6.10.rst
296
297
  - embulk-docs/src/release/release-0.6.2.rst
297
298
  - embulk-docs/src/release/release-0.6.3.rst
298
299
  - embulk-docs/src/release/release-0.6.4.rst
@@ -408,8 +409,8 @@ files:
408
409
  - classpath/bval-jsr303-0.5.jar
409
410
  - classpath/commons-beanutils-core-1.8.3.jar
410
411
  - classpath/commons-lang3-3.1.jar
411
- - classpath/embulk-core-0.6.9.jar
412
- - classpath/embulk-standards-0.6.9.jar
412
+ - classpath/embulk-core-0.6.10.jar
413
+ - classpath/embulk-standards-0.6.10.jar
413
414
  - classpath/guava-18.0.jar
414
415
  - classpath/guice-4.0.jar
415
416
  - classpath/guice-multibindings-4.0.jar