iron_worker_ng 0.1.9 → 0.1.10
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.
- data/README.md +115 -3
- data/VERSION +1 -1
- data/bin/iron_worker_ng +1 -1
- data/lib/iron_worker_ng/code/ruby.rb +2 -5
- metadata +2 -2
data/README.md
CHANGED
@@ -31,7 +31,7 @@ puts "I got '#{params}' parameters"
|
|
31
31
|
|
32
32
|
Everything your worker will output to stdout will be logged and available for your review when worker will finish execution.
|
33
33
|
|
34
|
-
#
|
34
|
+
# Creating Code Package
|
35
35
|
|
36
36
|
As this code will be executed on the cloud, you'll need to supply it with all necessary gems and supplementary data. IronWorkerNG::Code::Ruby will help you to do this.
|
37
37
|
|
@@ -141,7 +141,7 @@ client = IronWorkerNG::Client.new(:token => 'IRON_IO_TOKEN', :project_id => 'IRO
|
|
141
141
|
|
142
142
|
### codes.list(options = {})
|
143
143
|
|
144
|
-
Returns array of information about uploaded codes. Visit http://dev.iron.io/worker/reference/api/#list_code_packages for more information about options and code object format.
|
144
|
+
Returns array of information about uploaded codes. Visit http://dev.iron.io/worker/reference/api/#list_code_packages for more information about options and code information object format.
|
145
145
|
|
146
146
|
```ruby
|
147
147
|
client.codes.list.each do |code|
|
@@ -151,7 +151,7 @@ end
|
|
151
151
|
|
152
152
|
### codes.get(code_id)
|
153
153
|
|
154
|
-
Returns information about uploaded code with specified code_id.
|
154
|
+
Returns information about uploaded code with specified code_id. Visit http://dev.iron.io/worker/reference/api/#get_info_about_a_code_package for more information about code information object format.
|
155
155
|
|
156
156
|
```ruby
|
157
157
|
puts client.codes.get('1234567890').name
|
@@ -182,3 +182,115 @@ client.codes.revisions('1234567890').each do |revision|
|
|
182
182
|
puts revision.inspect
|
183
183
|
end
|
184
184
|
```
|
185
|
+
|
186
|
+
### codes.download(code_id, options = {})
|
187
|
+
|
188
|
+
Download code package with specified id and returns it to you as array of bytes. Visit http://dev.iron.io/worker/reference/api/#download_a_code_package for more information about options.
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
data = client.codes.download('1234567890')
|
192
|
+
```
|
193
|
+
|
194
|
+
### tasks.list(options = {})
|
195
|
+
|
196
|
+
Returns array of information about tasks. Visit http://dev.iron.io/worker/reference/api/#list_tasks for more information about options and task information object format.
|
197
|
+
|
198
|
+
```ruby
|
199
|
+
client.tasks.list.each do |task|
|
200
|
+
puts task.inspect
|
201
|
+
end
|
202
|
+
```
|
203
|
+
|
204
|
+
### tasks.get(task_id)
|
205
|
+
|
206
|
+
Returns information about task with specified task_id. Visit http://dev.iron.io/worker/reference/api/#get_info_about_a_task for more information about task information object format.
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
puts client.tasks.get('1234567890').code_name
|
210
|
+
```
|
211
|
+
|
212
|
+
### tasks.create(code_name, params = {}, options = {})
|
213
|
+
|
214
|
+
Queues new task for code with specified code_name, passes params hash to it and returns task information object with only id field filled. Visit http://dev.iron.io/worker/reference/api/#queue_a_task for more information about options.
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
task = client.tasks.create('MyWorker', {:client => 'Joe'}, {:delay => 180})
|
218
|
+
puts task.id
|
219
|
+
```
|
220
|
+
|
221
|
+
### tasks.cancel(task_id)
|
222
|
+
|
223
|
+
Cancels task with specified task_id.
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
client.tasks.cancel('1234567890')
|
227
|
+
```
|
228
|
+
|
229
|
+
### tasks.cancel_all(code_id)
|
230
|
+
|
231
|
+
Cancels all tasks for code package identified by specified code_id.
|
232
|
+
|
233
|
+
```ruby
|
234
|
+
client.tasks.cancel_all('1234567890')
|
235
|
+
```
|
236
|
+
|
237
|
+
### tasks.log(task_id)
|
238
|
+
|
239
|
+
Returns full task log for task with specified task_id. Please note that log is available only when task completed execution.
|
240
|
+
|
241
|
+
```ruby
|
242
|
+
puts client.tasks.log('1234567890')
|
243
|
+
```
|
244
|
+
|
245
|
+
### tasks.set_progress(task_id, options = {})
|
246
|
+
|
247
|
+
Sets task progress information for task with specified task_id. Should be used from within worker to inform you about worker execution status which you'll get via tasks.get call. Visit http://dev.iron.io/worker/reference/api/#set_a_tasks_progress for more information about options.
|
248
|
+
|
249
|
+
```ruby
|
250
|
+
client.tasks.set_progress('1234567890', {:msg => 'Still running...'})
|
251
|
+
```
|
252
|
+
|
253
|
+
### tasks.wait_for(task_id, options = {})
|
254
|
+
|
255
|
+
Waits while task identified by specified task_id executes. Options can containt :sleep parameter used to sleep between API invocations which defaults to 5 seconds. If block is provided, it'll be yielded after each API call with task information object as parameter.
|
256
|
+
|
257
|
+
```ruby
|
258
|
+
client.tasks.wait_for('1234567890') do |task|
|
259
|
+
puts task.msg
|
260
|
+
end
|
261
|
+
```
|
262
|
+
|
263
|
+
### schedules.list(options = {})
|
264
|
+
|
265
|
+
Returns array of information about schedules. Visit http://dev.iron.io/worker/reference/api/#list_scheduled_tasks for more information about options and schedule information object format.
|
266
|
+
|
267
|
+
```ruby
|
268
|
+
client.schedules.list.each do |schedule|
|
269
|
+
puts schedule.inspect
|
270
|
+
end
|
271
|
+
```
|
272
|
+
|
273
|
+
### schedules.get(schedule_id)
|
274
|
+
|
275
|
+
Returns information about schedule with specified schedule_id. Visit http://dev.iron.io/worker/reference/api/#get_info_about_a_scheduled_task for more information about schedule information object format.
|
276
|
+
|
277
|
+
```ruby
|
278
|
+
puts client.schedules.get('1234567890').last_run_time
|
279
|
+
```
|
280
|
+
|
281
|
+
### schedules.create(code_name, params = {}, options = {})
|
282
|
+
|
283
|
+
Creates new schedule for code with specified code_name, passes params hash to it and returns schedule information object with only id field filled. Visit http://dev.iron.io/worker/reference/api/#schedule_a_task for more information about options.
|
284
|
+
|
285
|
+
```ruby
|
286
|
+
schedule = client.schedules.create('MyWorker', {:client => 'Joe'}, {:start_at => Time.now + 3600})
|
287
|
+
puts schedule.id
|
288
|
+
```
|
289
|
+
|
290
|
+
### schedules.cancel(schdule_id)
|
291
|
+
|
292
|
+
Cancels schedule with specified schedule_id.
|
293
|
+
|
294
|
+
```ruby
|
295
|
+
client.schedules.cancel('1234567890')
|
296
|
+
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
data/bin/iron_worker_ng
CHANGED
@@ -19,7 +19,7 @@ if ENV['IRON_IO_TOKEN'].nil? || ENV['IRON_IO_PROJECT_ID'].nil?
|
|
19
19
|
exit 1
|
20
20
|
end
|
21
21
|
|
22
|
-
client = IronWorkerNG::Client.new(ENV['IRON_IO_TOKEN'], ENV['IRON_IO_PROJECT_ID'])
|
22
|
+
client = IronWorkerNG::Client.new(:token => ENV['IRON_IO_TOKEN'], :project_id => ENV['IRON_IO_PROJECT_ID'])
|
23
23
|
|
24
24
|
if command == 'codes.create'
|
25
25
|
runtimes = IronWorkerNG::Code::Base.registered_types
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: undecided -*-
|
1
2
|
require_relative '../feature/ruby/merge_gem'
|
2
3
|
require_relative '../feature/ruby/merge_gemfile'
|
3
4
|
require_relative '../feature/ruby/merge_worker'
|
@@ -39,11 +40,7 @@ require 'json'
|
|
39
40
|
|
40
41
|
@payload = File.read(payload_file)
|
41
42
|
|
42
|
-
parsed_payload =
|
43
|
-
begin
|
44
|
-
parsed_payload = JSON.parse(@payload)
|
45
|
-
rescue
|
46
|
-
end
|
43
|
+
parsed_payload = JSON.parse(@payload)
|
47
44
|
|
48
45
|
@iron_io_token = parsed_payload['token']
|
49
46
|
@iron_io_project_id = parsed_payload['project_id']
|
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.1.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
segments:
|
155
155
|
- 0
|
156
|
-
hash:
|
156
|
+
hash: 428102351
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
none: false
|
159
159
|
requirements:
|