patriot-gcp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/patriot_gcp/command/load_to_bigquery.rb +18 -17
- data/lib/patriot_gcp/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWU1ZjcyZTZkYjJlNmE2ZjVlNjU1MDVlOTNmOWRlOTAxOTQyZDU5Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Njk2ZDkwZWJmY2IyNjM0ZGNmNzk5YTQ3MWQ3ZWIyOGM4NTMwNWI3OQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZGQxM2E5ZDY2MjgwNGVlZTdlNmEzNmI0NTUyOGNlOTIyNWYwNGFmYmVmZDVk
|
10
|
+
MzU5ODNkZjhhNWE5OTMxZmNhZmZlZWQwMjljZjM4NjhkZWNmYTYyZWFhNmMw
|
11
|
+
MjdmNjliZGY1MmM4ZWIyN2JhZGM4MTdjMmZjZWI0NGQ2YWFlOWI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NzRlYzRmYmFjMDU3ODIxNmQzOGRjOGRkMDc0OTVkZWE3ZDg2OWU3YjM5M2M2
|
14
|
+
Zjg2OTdlZTdlMTVhOTlmOTdkMzhiNDdkZDMyMmMyNzRkZDMwYjRmMjE0OTA3
|
15
|
+
YjYwMDA2ZmE5ZjY5ZjcxOTdhOTYyMDYwNDk5NWRhYTg3YzQyY2Y=
|
@@ -4,21 +4,34 @@ module PatriotGCP
|
|
4
4
|
declare_command_name :load_to_bigquery
|
5
5
|
include PatriotGCP::Ext::BigQuery
|
6
6
|
|
7
|
-
command_attr :inifile, :dataset, :table, :schema, :options, :input_file, :name_suffix, :polling_interval
|
7
|
+
command_attr :inifile, :project_id, :dataset, :table, :schema, :options, :input_file, :name_suffix, :polling_interval
|
8
|
+
validate_existence :inifile, :project_id, :dataset, :table
|
8
9
|
|
9
10
|
class BigQueryException < Exception; end
|
10
11
|
class GoogleCloudPlatformException < Exception; end
|
11
12
|
|
12
13
|
def job_id
|
13
|
-
|
14
|
-
job_id = "#{job_id}_#{@name_suffix}" unless @name_suffix.nil?
|
15
|
-
return job_id
|
14
|
+
"#{command_name}_#{@project_id}_#{@dataset}_#{@table}_#{@name_suffix}"
|
16
15
|
end
|
17
16
|
|
17
|
+
# @see Patriot::Command::Base#configure
|
18
|
+
def configure
|
19
|
+
@name_suffix ||= _date_
|
20
|
+
self
|
21
|
+
end
|
18
22
|
|
19
23
|
def execute
|
20
24
|
@logger.info "start load_to_bigquery"
|
21
25
|
|
26
|
+
ini = IniFile.load(@inifile)
|
27
|
+
if ini.nil?
|
28
|
+
raise Exception, "inifile not found"
|
29
|
+
end
|
30
|
+
|
31
|
+
service_account = ini["gcp"]["service_account"]
|
32
|
+
private_key = ini["gcp"]["private_key"]
|
33
|
+
key_pass = ini["gcp"]["key_pass"]
|
34
|
+
|
22
35
|
unless File.exist?(@input_file)
|
23
36
|
raise Exception, "The given file doesn't exist."
|
24
37
|
end
|
@@ -28,20 +41,8 @@ module PatriotGCP
|
|
28
41
|
return
|
29
42
|
end
|
30
43
|
|
31
|
-
ini = IniFile.load(@inifile)
|
32
|
-
if ini.nil?
|
33
|
-
raise Exception, "inifile not found"
|
34
|
-
end
|
35
|
-
|
36
|
-
service_account = ini["gcp"]["service_account"]
|
37
|
-
private_key = ini["gcp"]["private_key"]
|
38
|
-
key_pass = ini["gcp"]["key_pass"]
|
39
|
-
project_id = ini["bigquery"]["project_id"]
|
40
|
-
|
41
44
|
if service_account.nil? or private_key.nil?
|
42
45
|
raise GoogleCloudPlatformException, "configuration for GCP is not enough."
|
43
|
-
elsif project_id.nil?
|
44
|
-
raise BigQueryException, "configuration for BigQuery is not enough."
|
45
46
|
end
|
46
47
|
|
47
48
|
@logger.info "start uploading"
|
@@ -49,7 +50,7 @@ module PatriotGCP
|
|
49
50
|
private_key,
|
50
51
|
key_pass,
|
51
52
|
service_account,
|
52
|
-
project_id,
|
53
|
+
@project_id,
|
53
54
|
@dataset,
|
54
55
|
@table,
|
55
56
|
@schema,
|
data/lib/patriot_gcp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patriot-gcp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hitoshi Tsuda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: patriot-workflow-scheduler
|
@@ -31,14 +31,14 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
-
|
34
|
+
- init.rb
|
35
|
+
- lib/patriot_gcp.rb
|
35
36
|
- lib/patriot_gcp/command.rb
|
36
|
-
- lib/patriot_gcp/
|
37
|
+
- lib/patriot_gcp/command/load_to_bigquery.rb
|
37
38
|
- lib/patriot_gcp/ext.rb
|
39
|
+
- lib/patriot_gcp/ext/bigquery.rb
|
38
40
|
- lib/patriot_gcp/version.rb
|
39
|
-
|
40
|
-
- init.rb
|
41
|
-
homepage: https://github.com/CyberAgent/patriot-workflow-scheduler
|
41
|
+
homepage: https://github.com/CyberAgent/patriot-workflow-scheduler/tree/master/plugins/patriot-gcp
|
42
42
|
licenses:
|
43
43
|
- Apache License, Version 2.0
|
44
44
|
metadata: {}
|
@@ -48,17 +48,17 @@ require_paths:
|
|
48
48
|
- lib
|
49
49
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - '>='
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- - '>='
|
56
|
+
- - ! '>='
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
60
|
rubyforge_project: patriot-gcp
|
61
|
-
rubygems_version: 2.
|
61
|
+
rubygems_version: 2.4.7
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: GCP plugin for Patriot Workflow Scheduler
|