iron_worker_ng 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/iron_worker +9 -1
- data/lib/iron_worker_ng/cli.rb +7 -3
- data/lib/iron_worker_ng/code/base.rb +6 -2
- data/lib/iron_worker_ng/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: 21cb18e68aec2b9f25a095b90a195e4f9a7db3aa
|
4
|
+
data.tar.gz: 980cae983aff2f5c6ba5279bac6ce652de96a7e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e85488731c141bd7ac2a9df0fd04ba121fa77d3d4c05b26f3e7c818c63fc9b51c57aabb90d85fca0a24a9e478961b3caddfd1f4aa536898271691cfd8fcb5ba5
|
7
|
+
data.tar.gz: 076068df20091a051c19e95cc85c4748bc6cdd11e9987b45768f0e74439b56bbd8959b420cd56242497b4a92d0e867b490c5d63d3a7d6da751bc8cc0fd94f240
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ All output to `STDOUT` will be logged and available for your review when your wo
|
|
34
34
|
|
35
35
|
# Creating The Code Package
|
36
36
|
|
37
|
-
Before you can
|
37
|
+
Before you can use IronWorker, be sure you've [created a free account with Iron.io](http://www.iron.io)
|
38
38
|
and [setup your Iron.io credentials on your system](http://dev.iron.io/worker/reference/configuration/) (either in a json
|
39
39
|
file or using ENV variables). You only need to do that once for your machine. If you've done that, then you can continue.
|
40
40
|
|
data/bin/iron_worker
CHANGED
@@ -175,6 +175,10 @@ elsif command == 'queue' || command == 'schedule'
|
|
175
175
|
options[:delay] = v
|
176
176
|
end
|
177
177
|
|
178
|
+
opts.on('--cluster CLUSTER', String, 'Run task on selected cluster') do |v|
|
179
|
+
options[:cluster] = v
|
180
|
+
end
|
181
|
+
|
178
182
|
if command == 'queue'
|
179
183
|
opts.on('--wait', Integer, 'wait for task to complete and print log') do |v|
|
180
184
|
options[:wait] = true
|
@@ -295,6 +299,10 @@ elsif command == 'run'
|
|
295
299
|
params[:payload] = File.read(v)
|
296
300
|
end
|
297
301
|
|
302
|
+
opts.on('--worker-config CONFIG_FILE', 'config file for worker') do |v|
|
303
|
+
options[:worker_config] = v
|
304
|
+
end
|
305
|
+
|
298
306
|
common_opts(opts)
|
299
307
|
end
|
300
308
|
|
@@ -448,4 +456,4 @@ elsif command == 'info'
|
|
448
456
|
|
449
457
|
elsif command == 'stacks'
|
450
458
|
@cli.stacks_list
|
451
|
-
end
|
459
|
+
end
|
data/lib/iron_worker_ng/cli.rb
CHANGED
@@ -212,10 +212,14 @@ module IronWorkerNG
|
|
212
212
|
code = IronWorkerNG::Code::Base.new(name)
|
213
213
|
|
214
214
|
log "Code package name is '#{code.name}'"
|
215
|
-
|
216
215
|
log_group "Running '#{code.name}'"
|
217
|
-
|
218
|
-
|
216
|
+
|
217
|
+
if options[:worker_config]
|
218
|
+
log "Loading worker_config at #{options[:worker_config]}"
|
219
|
+
c = IO.read(options[:worker_config])
|
220
|
+
options[:config] = c
|
221
|
+
end
|
222
|
+
code.run(params[:payload] || params['payload'], options[:config] || options['config'])
|
219
223
|
end
|
220
224
|
|
221
225
|
def install(name, params, options)
|
@@ -325,18 +325,22 @@ RUNNER
|
|
325
325
|
container.name
|
326
326
|
end
|
327
327
|
|
328
|
-
def run(params = {})
|
328
|
+
def run(params = {}, config = {})
|
329
329
|
container_name = create_container(true)
|
330
330
|
|
331
331
|
payload = File.open("#{container_name}/__payload__", 'wb')
|
332
332
|
payload.write(params.is_a?(String) ? params : params.to_json)
|
333
333
|
payload.close
|
334
334
|
|
335
|
+
config_file = File.open("#{container_name}/__config__", 'wb')
|
336
|
+
config_file.write(config.is_a?(String) ? config : config.to_json)
|
337
|
+
config_file.close
|
338
|
+
|
335
339
|
if @remote_build_command
|
336
340
|
system("cd #{container_name} && #{@remote_build_command}")
|
337
341
|
end
|
338
342
|
|
339
|
-
system("sh #{container_name}/__runner__.sh -d #{container_name} -payload #{container_name}/__payload__ -id 0")
|
343
|
+
system("sh #{container_name}/__runner__.sh -d #{container_name} -payload #{container_name}/__payload__ -config #{container_name}/__config__ -id 0")
|
340
344
|
|
341
345
|
FileUtils.rm_rf(container_name)
|
342
346
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_worker_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kirilenko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|