bricolage 5.22.0 → 5.22.1
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/lib/bricolage/jobnetrunner.rb +47 -9
- data/lib/bricolage/taskqueue.rb +2 -0
- data/lib/bricolage/version.rb +1 -1
- data/test/home/Gemfile.lock +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d23da6e1aee97530773a60aafdb8f521b5b59685
|
|
4
|
+
data.tar.gz: d2558688f61f529f8ea19e0a5d902e0e6d558bf6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff04d18f0ae2d91cf6b79811e1390848ddf3ba070a459b924a2e93766bcbd460ddb49520a0fa0d51a3a2f9486f581d04bc560c1dbd4397ebbd4e4617b8371982
|
|
7
|
+
data.tar.gz: da630e751c5a614bf13a70f992d4025782741a80db0e7c0ba5ade16ea62ea5c131709fc4aa1e20084dcc6bc9a380b331c8dff16c70014c223bfc1bdfefed8f70
|
|
@@ -38,7 +38,7 @@ module Bricolage
|
|
|
38
38
|
opts = Options.new(self)
|
|
39
39
|
@hooks.run_before_option_parsing_hooks(opts)
|
|
40
40
|
opts.parse ARGV
|
|
41
|
-
@ctx = Context.for_application(
|
|
41
|
+
@ctx = Context.for_application(job_path: opts.jobnet_file, environment: opts.environment, global_variables: opts.global_variables)
|
|
42
42
|
@jobnet_id = "#{opts.jobnet_file.dirname.basename}/#{opts.jobnet_file.basename('.jobnet')}"
|
|
43
43
|
@log_path = opts.log_path
|
|
44
44
|
jobnet =
|
|
@@ -53,7 +53,7 @@ module Bricolage
|
|
|
53
53
|
end
|
|
54
54
|
unless queue.queued?
|
|
55
55
|
enqueue_jobs jobnet, queue
|
|
56
|
-
logger.info "jobs are queued."
|
|
56
|
+
logger.info "jobs are queued."
|
|
57
57
|
end
|
|
58
58
|
if opts.list_jobs?
|
|
59
59
|
list_jobs queue
|
|
@@ -79,13 +79,32 @@ module Bricolage
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def get_queue(opts)
|
|
82
|
-
if opts
|
|
83
|
-
|
|
82
|
+
if path = get_queue_file_path(opts)
|
|
83
|
+
logger.info "queue path: #{path}"
|
|
84
|
+
FileTaskQueue.restore_if_exist(path)
|
|
84
85
|
else
|
|
85
86
|
TaskQueue.new
|
|
86
87
|
end
|
|
87
88
|
end
|
|
88
89
|
|
|
90
|
+
def get_queue_file_path(opts)
|
|
91
|
+
if opts.queue_path
|
|
92
|
+
opts.queue_path
|
|
93
|
+
elsif opts.enable_queue?
|
|
94
|
+
opts.local_state_dir + 'queue' + "#{app_name}.#{@jobnet_id.tr('/', '.')}"
|
|
95
|
+
else
|
|
96
|
+
nil
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def app_name
|
|
101
|
+
path = @ctx.home_path.realpath
|
|
102
|
+
while /\A(?:\d+|current|releases)\z/ =~ path.basename.to_s # is Capistrano dirs
|
|
103
|
+
path = path.dirname
|
|
104
|
+
end
|
|
105
|
+
path.basename.to_s
|
|
106
|
+
end
|
|
107
|
+
|
|
89
108
|
def enqueue_jobs(jobnet, queue)
|
|
90
109
|
seq = 1
|
|
91
110
|
jobnet.sequential_jobs.each do |ref|
|
|
@@ -176,7 +195,17 @@ module Bricolage
|
|
|
176
195
|
@environment = nil
|
|
177
196
|
@jobnet_files = nil
|
|
178
197
|
@log_path = LogFilePath.default
|
|
179
|
-
@
|
|
198
|
+
@local_state_dir = Pathname('/tmp/bricolage')
|
|
199
|
+
if path = ENV['BRICOLAGE_QUEUE_PATH']
|
|
200
|
+
@enable_queue = true
|
|
201
|
+
@queue_path = Pathname(path)
|
|
202
|
+
elsif ENV['BRICOLAGE_ENABLE_QUEUE']
|
|
203
|
+
@enable_queue = true
|
|
204
|
+
@queue_path = nil
|
|
205
|
+
else
|
|
206
|
+
@enable_queue = false
|
|
207
|
+
@queue_path = nil
|
|
208
|
+
end
|
|
180
209
|
@check_only = false
|
|
181
210
|
@list_jobs = false
|
|
182
211
|
@global_variables = Variables.new
|
|
@@ -186,13 +215,16 @@ module Bricolage
|
|
|
186
215
|
|
|
187
216
|
attr_reader :environment
|
|
188
217
|
attr_reader :jobnet_file
|
|
189
|
-
attr_reader :queue_path
|
|
190
218
|
attr_reader :log_path
|
|
191
219
|
|
|
192
|
-
|
|
193
|
-
|
|
220
|
+
attr_reader :local_state_dir
|
|
221
|
+
|
|
222
|
+
def enable_queue?
|
|
223
|
+
@enable_queue
|
|
194
224
|
end
|
|
195
225
|
|
|
226
|
+
attr_reader :queue_path
|
|
227
|
+
|
|
196
228
|
def check_only?
|
|
197
229
|
@check_only
|
|
198
230
|
end
|
|
@@ -222,7 +254,13 @@ Options:
|
|
|
222
254
|
parser.on('--log-path=PATH', 'Log file path template.') {|path|
|
|
223
255
|
@log_path = LogFilePath.new(path)
|
|
224
256
|
}
|
|
225
|
-
parser.on('--
|
|
257
|
+
parser.on('--local-state-dir=PATH', 'Stores local state in this path.') {|path|
|
|
258
|
+
@local_state_dir = Pathname(path)
|
|
259
|
+
}
|
|
260
|
+
parser.on('--enable-queue', 'Enables job queue.') {
|
|
261
|
+
@enable_queue = true
|
|
262
|
+
}
|
|
263
|
+
parser.on('--queue-path=PATH', 'Enables job queue with this path.') {|path|
|
|
226
264
|
@queue_path = Pathname(path)
|
|
227
265
|
}
|
|
228
266
|
parser.on('-c', '--check-only', 'Checks job parameters and quit without executing.') {
|
data/lib/bricolage/taskqueue.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'bricolage/jobnet'
|
|
2
2
|
require 'bricolage/exception'
|
|
3
|
+
require 'fileutils'
|
|
3
4
|
require 'pathname'
|
|
4
5
|
|
|
5
6
|
module Bricolage
|
|
@@ -92,6 +93,7 @@ module Bricolage
|
|
|
92
93
|
@path.unlink if @path.exist?
|
|
93
94
|
return
|
|
94
95
|
end
|
|
96
|
+
FileUtils.mkdir_p @path.dirname
|
|
95
97
|
tmpname = "#{@path}.tmp.#{Process.pid}"
|
|
96
98
|
begin
|
|
97
99
|
File.open(tmpname, 'w') {|f|
|
data/lib/bricolage/version.rb
CHANGED
data/test/home/Gemfile.lock
CHANGED