samidare 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/samidare.rb +21 -6
- data/lib/samidare/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f97f6368bca22b657df37c1279d7b5d07c514c76
|
4
|
+
data.tar.gz: 62f4b01e91cfda7c95b787e71a047e5d8fb2155f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64dde2e0f6fd33eae7b2d044acabe546ee097745617410a751b6dfa48e3fd8bd8389d80e820037ec876b299e74637ef6ea1db22dbe56e793b3a55c533e7ef166
|
7
|
+
data.tar.gz: 1c687b2b61a237444ce5d7e9f1dbf44d73985482a0ef8d31178806a1321a11224b97277d756c26ffffb891f87689e57335e0772ae913340805a5418c77b14ada
|
data/lib/samidare.rb
CHANGED
@@ -9,19 +9,34 @@ module Samidare
|
|
9
9
|
Samidare::EmbulkUtility::ConfigGenerator.new.generate_config(database_configs, bq_config)
|
10
10
|
end
|
11
11
|
|
12
|
-
def run(bq_config, target_table_names = [])
|
12
|
+
def run(bq_config, target_table_names = [], retry_max = 0)
|
13
|
+
error_tables = run_and_retry(bq_config, target_table_names, retry_max, 0)
|
14
|
+
# return batch status(true: all tables success)
|
15
|
+
error_tables.size == 0
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def run_and_retry(bq_config, target_table_names = [], retry_max, retry_count)
|
13
20
|
error_tables = Samidare::Embulk.new.run(
|
14
21
|
database_configs,
|
15
|
-
|
22
|
+
table_configs,
|
16
23
|
bq_config,
|
17
24
|
target_table_names)
|
18
|
-
|
19
|
-
|
25
|
+
if error_tables.size > 0 && retry_count < retry_max
|
26
|
+
puts "------------------------------------"
|
27
|
+
puts "retry start -> #{retry_count + 1} time"
|
28
|
+
puts "------------------------------------"
|
29
|
+
error_tables = run_and_retry(bq_config, error_tables, retry_max, retry_count + 1)
|
30
|
+
end
|
31
|
+
error_tables
|
20
32
|
end
|
21
33
|
|
22
|
-
private
|
23
34
|
def database_configs
|
24
|
-
YAML.load_file('database.yml')
|
35
|
+
@database_configs ||= YAML.load_file('database.yml')
|
36
|
+
end
|
37
|
+
|
38
|
+
def table_configs
|
39
|
+
@table_configs ||= Samidare::MySQL::TableConfig.generate_table_configs
|
25
40
|
end
|
26
41
|
end
|
27
42
|
end
|
data/lib/samidare/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samidare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryoji Kobori
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|