dronejob 1.2.8 → 1.2.9
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 +4 -4
- data/Gemfile.lock +43 -19
- data/dronejob.gemspec +2 -1
- data/lib/dronejob/modules/log.rb +68 -10
- data/lib/dronejob/modules/phases.rb +1 -1
- data/lib/dronejob/version.rb +1 -1
- data/lib/dronejob.rb +1 -0
- metadata +19 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e08177ceade5bbe5e6cc87316b4c6c5bd797613
|
|
4
|
+
data.tar.gz: f8d6934e24e5055edd50b51c982c9c122275f8e5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a66d0011224e6351b3cf34664ae90ef97c928cf0fd7b2fafdd1268a8c0d714ead324046cf053c35aeb81df6e8a972559a98c74d855f059b1b970cedf61100de5
|
|
7
|
+
data.tar.gz: c6a7aa834e83ed43d9c400e4f80a062875bf4f46d1f53c56547d44945c8e0397fd68374925da5253120863537bae399be8cc84a91dd7c1b7f6086c0baba6f785
|
data/Gemfile.lock
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
dronejob (1.2.
|
|
4
|
+
dronejob (1.2.9)
|
|
5
5
|
actionpack (>= 4.0)
|
|
6
6
|
activejob (~> 4.2)
|
|
7
7
|
bundler (>= 1.3.0, < 2.0)
|
|
8
8
|
git (~> 1.2)
|
|
9
|
-
google-cloud-
|
|
9
|
+
google-cloud-logging (~> 0.23)
|
|
10
|
+
google-cloud-storage (~> 0.23)
|
|
10
11
|
haml (~> 4.0)
|
|
11
12
|
open_uri_redirections (~> 0.2)
|
|
12
13
|
rubyzip (~> 1.1)
|
|
@@ -42,22 +43,22 @@ GEM
|
|
|
42
43
|
tzinfo (~> 1.1)
|
|
43
44
|
addressable (2.5.0)
|
|
44
45
|
public_suffix (~> 2.0, >= 2.0.2)
|
|
45
|
-
builder (3.2.
|
|
46
|
+
builder (3.2.3)
|
|
46
47
|
coderay (1.1.1)
|
|
47
|
-
concurrent-ruby (1.0.
|
|
48
|
+
concurrent-ruby (1.0.4)
|
|
48
49
|
connection_pool (2.2.1)
|
|
49
50
|
diff-lcs (1.2.5)
|
|
50
51
|
digest-crc (0.4.1)
|
|
51
52
|
erubis (2.7.0)
|
|
52
53
|
ethon (0.10.1)
|
|
53
54
|
ffi (>= 1.3.0)
|
|
54
|
-
faraday (0.
|
|
55
|
+
faraday (0.11.0)
|
|
55
56
|
multipart-post (>= 1.2, < 3)
|
|
56
|
-
ffi (1.9.
|
|
57
|
+
ffi (1.9.17)
|
|
57
58
|
git (1.3.0)
|
|
58
59
|
globalid (0.3.7)
|
|
59
60
|
activesupport (>= 4.1.0)
|
|
60
|
-
google-api-client (0.9.
|
|
61
|
+
google-api-client (0.9.28)
|
|
61
62
|
addressable (~> 2.3)
|
|
62
63
|
googleauth (~> 0.5)
|
|
63
64
|
httpclient (~> 2.7)
|
|
@@ -68,10 +69,27 @@ GEM
|
|
|
68
69
|
retriable (~> 2.0)
|
|
69
70
|
google-cloud-core (0.21.1)
|
|
70
71
|
googleauth (~> 0.5.1)
|
|
71
|
-
google-cloud-
|
|
72
|
+
google-cloud-logging (0.23.2)
|
|
73
|
+
google-cloud-core (~> 0.21.1)
|
|
74
|
+
google-gax (~> 0.6.0)
|
|
75
|
+
google-protobuf (~> 3.0)
|
|
76
|
+
googleapis-common-protos (~> 1.3)
|
|
77
|
+
grpc (~> 1.0)
|
|
78
|
+
orderedhash (= 0.0.6)
|
|
79
|
+
stackdriver-core (~> 0.21.0)
|
|
80
|
+
google-cloud-storage (0.23.1)
|
|
72
81
|
digest-crc (~> 0.4)
|
|
73
82
|
google-api-client (~> 0.9.11)
|
|
74
83
|
google-cloud-core (~> 0.21.0)
|
|
84
|
+
google-gax (0.6.0)
|
|
85
|
+
googleapis-common-protos (~> 1.3.1)
|
|
86
|
+
googleauth (~> 0.5.1)
|
|
87
|
+
grpc (~> 1.0)
|
|
88
|
+
rly (~> 0.2.3)
|
|
89
|
+
google-protobuf (3.2.0)
|
|
90
|
+
googleapis-common-protos (1.3.4)
|
|
91
|
+
google-protobuf (~> 3.0)
|
|
92
|
+
grpc (~> 1.0)
|
|
75
93
|
googleauth (0.5.1)
|
|
76
94
|
faraday (~> 0.9)
|
|
77
95
|
jwt (~> 1.4)
|
|
@@ -80,12 +98,15 @@ GEM
|
|
|
80
98
|
multi_json (~> 1.11)
|
|
81
99
|
os (~> 0.9)
|
|
82
100
|
signet (~> 0.7)
|
|
101
|
+
grpc (1.1.2)
|
|
102
|
+
google-protobuf (~> 3.1)
|
|
103
|
+
googleauth (~> 0.5.1)
|
|
83
104
|
haml (4.0.7)
|
|
84
105
|
tilt
|
|
85
106
|
httpclient (2.8.3)
|
|
86
107
|
hurley (0.2)
|
|
87
|
-
i18n (0.
|
|
88
|
-
json (1.8.
|
|
108
|
+
i18n (0.8.0)
|
|
109
|
+
json (1.8.6)
|
|
89
110
|
jwt (1.5.6)
|
|
90
111
|
little-plugger (1.1.4)
|
|
91
112
|
logging (2.1.0)
|
|
@@ -102,15 +123,16 @@ GEM
|
|
|
102
123
|
minitest (5.10.1)
|
|
103
124
|
multi_json (1.12.1)
|
|
104
125
|
multipart-post (2.0.0)
|
|
105
|
-
nokogiri (1.
|
|
126
|
+
nokogiri (1.7.0.1)
|
|
106
127
|
mini_portile2 (~> 2.1.0)
|
|
107
128
|
open_uri_redirections (0.2.1)
|
|
129
|
+
orderedhash (0.0.6)
|
|
108
130
|
os (0.9.6)
|
|
109
131
|
pry (0.10.3)
|
|
110
132
|
coderay (~> 1.1.0)
|
|
111
133
|
method_source (~> 0.8.1)
|
|
112
134
|
slop (~> 3.4)
|
|
113
|
-
public_suffix (2.0.
|
|
135
|
+
public_suffix (2.0.5)
|
|
114
136
|
rack (1.6.5)
|
|
115
137
|
rack-protection (1.5.3)
|
|
116
138
|
rack
|
|
@@ -118,16 +140,17 @@ GEM
|
|
|
118
140
|
rack (>= 1.0)
|
|
119
141
|
rails-deprecated_sanitizer (1.0.3)
|
|
120
142
|
activesupport (>= 4.2.0.alpha)
|
|
121
|
-
rails-dom-testing (1.0.
|
|
143
|
+
rails-dom-testing (1.0.8)
|
|
122
144
|
activesupport (>= 4.2.0.beta, < 5.0)
|
|
123
|
-
nokogiri (~> 1.6
|
|
145
|
+
nokogiri (~> 1.6)
|
|
124
146
|
rails-deprecated_sanitizer (>= 1.0.1)
|
|
125
147
|
rails-html-sanitizer (1.0.3)
|
|
126
148
|
loofah (~> 2.0)
|
|
127
|
-
redis (3.3.
|
|
149
|
+
redis (3.3.3)
|
|
128
150
|
representable (2.3.0)
|
|
129
151
|
uber (~> 0.0.7)
|
|
130
152
|
retriable (2.1.0)
|
|
153
|
+
rly (0.2.3)
|
|
131
154
|
rspec (3.4.0)
|
|
132
155
|
rspec-core (~> 3.4.0)
|
|
133
156
|
rspec-expectations (~> 3.4.0)
|
|
@@ -141,8 +164,8 @@ GEM
|
|
|
141
164
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
142
165
|
rspec-support (~> 3.4.0)
|
|
143
166
|
rspec-support (3.4.1)
|
|
144
|
-
rubyzip (1.2.
|
|
145
|
-
sidekiq (4.2.
|
|
167
|
+
rubyzip (1.2.1)
|
|
168
|
+
sidekiq (4.2.9)
|
|
146
169
|
concurrent-ruby (~> 1.0)
|
|
147
170
|
connection_pool (~> 2.2, >= 2.2.0)
|
|
148
171
|
rack-protection (>= 1.5.0)
|
|
@@ -155,9 +178,10 @@ GEM
|
|
|
155
178
|
jwt (~> 1.5)
|
|
156
179
|
multi_json (~> 1.10)
|
|
157
180
|
slop (3.6.0)
|
|
181
|
+
stackdriver-core (0.21.0)
|
|
158
182
|
thor (0.19.4)
|
|
159
183
|
thread_safe (0.3.5)
|
|
160
|
-
tilt (2.0.
|
|
184
|
+
tilt (2.0.6)
|
|
161
185
|
typhoeus (1.1.2)
|
|
162
186
|
ethon (>= 0.9.0)
|
|
163
187
|
tzinfo (1.2.2)
|
|
@@ -173,4 +197,4 @@ DEPENDENCIES
|
|
|
173
197
|
rspec (~> 3.3)
|
|
174
198
|
|
|
175
199
|
BUNDLED WITH
|
|
176
|
-
1.13.
|
|
200
|
+
1.13.7
|
data/dronejob.gemspec
CHANGED
|
@@ -25,7 +25,8 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.add_runtime_dependency "typhoeus", "~> 1.0"
|
|
26
26
|
s.add_runtime_dependency "actionpack", ">= 4.0"
|
|
27
27
|
s.add_runtime_dependency "open_uri_redirections", "~> 0.2"
|
|
28
|
-
s.add_runtime_dependency "google-cloud-storage", "~> 0.
|
|
28
|
+
s.add_runtime_dependency "google-cloud-storage", "~> 0.23"
|
|
29
|
+
s.add_runtime_dependency "google-cloud-logging", "~> 0.23"
|
|
29
30
|
s.add_development_dependency "rspec", "~> 3.3"
|
|
30
31
|
s.add_development_dependency "pry", "~> 0.10"
|
|
31
32
|
s.files = `git ls-files`.split("\n")
|
data/lib/dronejob/modules/log.rb
CHANGED
|
@@ -17,6 +17,10 @@ module Dronejob
|
|
|
17
17
|
dronejob_log = option(:dronejob_log) || "STDOUT"
|
|
18
18
|
if dronejob_log == "STDOUT"
|
|
19
19
|
custom_logger = ActiveSupport::Logger.new(STDOUT)
|
|
20
|
+
elsif dronejob_log == "google"
|
|
21
|
+
logging = Google::Cloud::Logging.new(project: option(:google_cloud_project_id))
|
|
22
|
+
resource = logging.resource("gce_instance", { zone: option(:google_cloud_zone), instance_id: option(:google_cloud_instance_id) })
|
|
23
|
+
custom_logger = logging.logger("drone", resource)
|
|
20
24
|
else
|
|
21
25
|
custom_logger = ActiveSupport::Logger.new(dronejob_log)
|
|
22
26
|
end
|
|
@@ -25,17 +29,27 @@ module Dronejob
|
|
|
25
29
|
end
|
|
26
30
|
|
|
27
31
|
class_methods do
|
|
28
|
-
def log(level, message,
|
|
32
|
+
def log(level, message, job)
|
|
29
33
|
if !logger.nil?
|
|
30
|
-
|
|
34
|
+
if option(:dronejob_log) == "google"
|
|
35
|
+
message = "[#{job.job_id}] #{message}" if level != :error
|
|
36
|
+
data = { message: message, job_id: job.job_id, queue: job.queue_name, phase: "none" }
|
|
37
|
+
data[:phase] = job.phase.to_s if job.phase
|
|
38
|
+
data[:user_id] = job.param(:user_id) if job.param(:user_id)
|
|
39
|
+
data[:phase_title] = job.phase_config[:title].to_s if job.phase_config and job.phase_config[:title]
|
|
40
|
+
data[:phase_progress] = job.phase_config[:progress] if job.phase_config and job.phase_config[:progress]
|
|
41
|
+
logger.send(level, data.compact)
|
|
42
|
+
else
|
|
43
|
+
logger.send(level, message)
|
|
44
|
+
end
|
|
31
45
|
else
|
|
32
|
-
puts "#{level}: [#{phase}] #{message}"
|
|
46
|
+
puts "#{level}: [#{job.phase}] #{message}"
|
|
33
47
|
end
|
|
34
48
|
end
|
|
35
49
|
end
|
|
36
50
|
|
|
37
51
|
def log(level, message)
|
|
38
|
-
self.class.log(level, message,
|
|
52
|
+
self.class.log(level, message, self)
|
|
39
53
|
end
|
|
40
54
|
|
|
41
55
|
def debug(message)
|
|
@@ -55,13 +69,17 @@ module Dronejob
|
|
|
55
69
|
end
|
|
56
70
|
|
|
57
71
|
def error(message)
|
|
58
|
-
if
|
|
59
|
-
if
|
|
60
|
-
log(:error, "#{
|
|
72
|
+
if message.kind_of?(StandardError)
|
|
73
|
+
if option(:dronejob_log) == "google"
|
|
74
|
+
log(:error, "#{message.backtrace.first}: #{message.message} (#{message.class})\n\t#{message.backtrace.drop(1).join("\n\t")}")
|
|
61
75
|
else
|
|
62
|
-
|
|
76
|
+
if log_stdout?
|
|
77
|
+
log(:error, "#{COLOR_RED_BG}#{COLOR_BOLD}#{COLOR_WHITE} ERROR #{COLOR_END} #{COLOR_BOLD}#{message.class}: #{COLOR_RED}#{message.message}#{COLOR_END}")
|
|
78
|
+
else
|
|
79
|
+
log(:error, "[ERROR] #{message.class}: #{message.message}")
|
|
80
|
+
end
|
|
81
|
+
backtrace(message.backtrace)
|
|
63
82
|
end
|
|
64
|
-
backtrace(message.backtrace)
|
|
65
83
|
else
|
|
66
84
|
log(:error, message)
|
|
67
85
|
end
|
|
@@ -95,7 +113,47 @@ module Dronejob
|
|
|
95
113
|
|
|
96
114
|
def emergency(message)
|
|
97
115
|
log(:emergency, message)
|
|
98
|
-
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
ActiveSupport.on_load :active_job do
|
|
119
|
+
class ActiveJob::Logging::LogSubscriber
|
|
120
|
+
def enqueue(event)
|
|
121
|
+
info do
|
|
122
|
+
job = event.payload[:job]
|
|
123
|
+
log_object("queueing #{job.class.name}", job)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def enqueue_at(event)
|
|
128
|
+
info do
|
|
129
|
+
job = event.payload[:job]
|
|
130
|
+
log_object("scheduling #{job.class.name}", job)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def perform_start(event)
|
|
135
|
+
info do
|
|
136
|
+
job = event.payload[:job]
|
|
137
|
+
log_object("starting #{job.class.name}", job)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def perform(event)
|
|
142
|
+
info do
|
|
143
|
+
job = event.payload[:job]
|
|
144
|
+
log_object("finishing #{job.class.name}", job)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def log_object(message, job)
|
|
149
|
+
if job.option(:dronejob_log) == "google"
|
|
150
|
+
{ message: "[#{job.job_id}] #{message}", job_id: job.job_id, queue: job.queue_name, phase: job.phase }
|
|
151
|
+
else
|
|
152
|
+
message
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
99
157
|
|
|
100
158
|
private
|
|
101
159
|
|
data/lib/dronejob/version.rb
CHANGED
data/lib/dronejob.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dronejob
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Strebitzer
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-02-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -176,14 +176,28 @@ dependencies:
|
|
|
176
176
|
requirements:
|
|
177
177
|
- - "~>"
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0.
|
|
179
|
+
version: '0.23'
|
|
180
180
|
type: :runtime
|
|
181
181
|
prerelease: false
|
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
|
184
184
|
- - "~>"
|
|
185
185
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '0.
|
|
186
|
+
version: '0.23'
|
|
187
|
+
- !ruby/object:Gem::Dependency
|
|
188
|
+
name: google-cloud-logging
|
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
|
190
|
+
requirements:
|
|
191
|
+
- - "~>"
|
|
192
|
+
- !ruby/object:Gem::Version
|
|
193
|
+
version: '0.23'
|
|
194
|
+
type: :runtime
|
|
195
|
+
prerelease: false
|
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
197
|
+
requirements:
|
|
198
|
+
- - "~>"
|
|
199
|
+
- !ruby/object:Gem::Version
|
|
200
|
+
version: '0.23'
|
|
187
201
|
- !ruby/object:Gem::Dependency
|
|
188
202
|
name: rspec
|
|
189
203
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -272,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
272
286
|
version: '2.4'
|
|
273
287
|
requirements: []
|
|
274
288
|
rubyforge_project:
|
|
275
|
-
rubygems_version: 2.
|
|
289
|
+
rubygems_version: 2.6.10
|
|
276
290
|
signing_key:
|
|
277
291
|
specification_version: 4
|
|
278
292
|
summary: DroneJob Drone Factory
|