iron_worker_ng 0.16.3 → 0.16.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/iron_worker +16 -2
- data/lib/iron_worker_ng/cli.rb +20 -11
- data/lib/iron_worker_ng/code/runtime/ruby.rb +7 -0
- data/lib/iron_worker_ng/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf217b118d97da56fdf20036b87cddbec177c697
|
4
|
+
data.tar.gz: 2efd49c7a8b76c22849a0c8a70858075ba343cce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25218886b07fbd334dc2675cf4b3e574f3940a862542f0182cc77afe439dd73d31540d7daa9ee95276b9f910f83943486eb54644a15ebbb8b44c0239c6b703bd
|
7
|
+
data.tar.gz: 7f4d0126915b6b8e7605ddc5a5ebdbb63f98a28b42b5fa58543f83a3d2d11d284330494509b8b0aba62db7ba23a9a7b465dfce11b835db2c51080ac039eb1516
|
data/bin/iron_worker
CHANGED
@@ -77,6 +77,10 @@ if command == 'upload'
|
|
77
77
|
options[:retries_delay] = v
|
78
78
|
end
|
79
79
|
|
80
|
+
opts.on('--worker-config CONFIG_FILE', 'config file for worker') do |v|
|
81
|
+
options[:worker_config] = v
|
82
|
+
end
|
83
|
+
|
80
84
|
opts.on('-h', '--host HOST', String, 'host name, eg: www.mydomain.com') do |v|
|
81
85
|
options[:host] = v
|
82
86
|
end
|
@@ -133,6 +137,12 @@ elsif command == 'queue' || command == 'schedule'
|
|
133
137
|
options[:delay] = v
|
134
138
|
end
|
135
139
|
|
140
|
+
if command == 'queue'
|
141
|
+
opts.on('--wait', Integer, 'wait for task to complete and print log') do |v|
|
142
|
+
options[:wait] = true
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
136
146
|
if command == 'schedule'
|
137
147
|
opts.on('--start-at TIME', 'start task at specified time') do |v|
|
138
148
|
options[:start_at] = Time.parse(v)
|
@@ -183,6 +193,10 @@ elsif command == 'retry'
|
|
183
193
|
options[:delay] = v
|
184
194
|
end
|
185
195
|
|
196
|
+
opts.on('--wait', Integer, 'wait for task to complete and print log') do |v|
|
197
|
+
options[:wait] = true
|
198
|
+
end
|
199
|
+
|
186
200
|
common_opts(opts)
|
187
201
|
end
|
188
202
|
|
@@ -207,8 +221,8 @@ elsif command == 'log'
|
|
207
221
|
opts = OptionParser.new do |opts|
|
208
222
|
opts.banner = "usage: iron_worker log TASK_ID [OPTIONS]"
|
209
223
|
|
210
|
-
opts.on('-w', '--wait', 'wait for task') do |v|
|
211
|
-
|
224
|
+
opts.on('-w', '--wait', 'wait for task to complete') do |v|
|
225
|
+
options[:wait] = true
|
212
226
|
end
|
213
227
|
|
214
228
|
common_opts(opts)
|
data/lib/iron_worker_ng/cli.rb
CHANGED
@@ -74,6 +74,12 @@ module IronWorkerNG
|
|
74
74
|
log "Retries delay set to '#{options[:retries_delay]}'" unless options[:retries_delay].nil?
|
75
75
|
log "Host set to '#{options[:host]}'" unless options[:host].nil?
|
76
76
|
|
77
|
+
if options[:worker_config]
|
78
|
+
log "Loading worker_config at #{options[:worker_config]}"
|
79
|
+
c = IO.read(options[:worker_config])
|
80
|
+
options[:config] = c
|
81
|
+
end
|
82
|
+
|
77
83
|
if code.remote_build_command || code.full_remote_build
|
78
84
|
log_group "Uploading and building code package '#{code.name}'"
|
79
85
|
else
|
@@ -103,6 +109,10 @@ module IronWorkerNG
|
|
103
109
|
|
104
110
|
log "Code package '#{name}' queued with id='#{id}'"
|
105
111
|
log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{id}' for more info"
|
112
|
+
|
113
|
+
if options[:wait] == true
|
114
|
+
getlog(id, {}, {:wait => true})
|
115
|
+
end
|
106
116
|
end
|
107
117
|
|
108
118
|
def schedule(name, params, options)
|
@@ -125,41 +135,40 @@ module IronWorkerNG
|
|
125
135
|
|
126
136
|
log "Task retried with id='#{retry_task_id}'"
|
127
137
|
log "Check 'https://hud.iron.io/tq/projects/#{client.api.project_id}/jobs/#{retry_task_id}' for more info"
|
138
|
+
|
139
|
+
if options[:wait] == true
|
140
|
+
getlog(retry_task_id, {}, {:wait => true})
|
141
|
+
end
|
128
142
|
end
|
129
143
|
|
130
144
|
def getlog(task_id, params, options)
|
131
145
|
client
|
132
146
|
|
133
|
-
|
134
|
-
wait = params[:wait] || params['wait']
|
147
|
+
wait = options[:wait] || options['wait']
|
135
148
|
|
136
149
|
log_group "Getting log for task with id='#{task_id}'"
|
137
150
|
|
138
151
|
log = ''
|
139
152
|
|
140
|
-
if
|
153
|
+
if wait
|
141
154
|
begin
|
142
155
|
log = client.tasks.log(task_id)
|
143
|
-
rescue
|
156
|
+
rescue
|
144
157
|
end
|
145
158
|
else
|
146
|
-
if wait
|
147
|
-
client.tasks.wait_for(task_id)
|
148
|
-
end
|
149
|
-
|
150
159
|
log = client.tasks.log(task_id)
|
151
160
|
end
|
152
161
|
|
153
162
|
print log
|
154
163
|
|
155
|
-
if
|
164
|
+
if wait
|
156
165
|
client.tasks.wait_for(task_id) do |task|
|
157
166
|
if task.status == 'running'
|
158
167
|
begin
|
159
168
|
next_log = client.tasks.log(task_id)
|
160
169
|
print next_log[log.length .. - 1]
|
161
170
|
log = next_log
|
162
|
-
rescue
|
171
|
+
rescue
|
163
172
|
end
|
164
173
|
end
|
165
174
|
end
|
@@ -167,7 +176,7 @@ module IronWorkerNG
|
|
167
176
|
begin
|
168
177
|
next_log = client.tasks.log(task_id)
|
169
178
|
print next_log[log.length .. - 1]
|
170
|
-
rescue
|
179
|
+
rescue
|
171
180
|
end
|
172
181
|
end
|
173
182
|
end
|
@@ -46,6 +46,7 @@ ENV['GEM_HOME'] = root + '__gems__'
|
|
46
46
|
$:.unshift("\#{root}")
|
47
47
|
|
48
48
|
require 'json'
|
49
|
+
require 'yaml'
|
49
50
|
|
50
51
|
@iron_task_id = task_id
|
51
52
|
|
@@ -64,6 +65,12 @@ if config_file
|
|
64
65
|
@config = JSON.parse(@config)
|
65
66
|
@config = IronWorkerNGHash.new(@config)
|
66
67
|
rescue
|
68
|
+
# try yaml
|
69
|
+
begin
|
70
|
+
@config = YAML.load(@config)
|
71
|
+
@config = IronWorkerNGHash.new(@config)
|
72
|
+
rescue
|
73
|
+
end
|
67
74
|
end
|
68
75
|
end
|
69
76
|
|
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: 0.16.
|
4
|
+
version: 0.16.4
|
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: 2013-04-
|
12
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|
@@ -151,6 +151,20 @@ dependencies:
|
|
151
151
|
- - '>='
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: 1.4.0
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: go
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
154
168
|
description: New generation ruby client for IronWorker
|
155
169
|
email:
|
156
170
|
- info@iron.io
|