iron_worker_ng 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,18 +1,18 @@
1
1
  # Introduction
2
2
 
3
- To run your code in cloud you need to do two things - upload code package to be executed and queue or schedule it for execution. While you can use REST APIs for that, it's always better to use IronWorker library created specificaly for your language of choice such as IronWorkerNG.
3
+ To run your code in cloud you need to do two things - upload code package to be executed and queue or schedule it for execution. While you can use REST APIs for that, it's easier to use an IronWorker library created specifically for your language of choice, such as IronWorkerNG.
4
4
 
5
5
  # Preparing Environment
6
6
 
7
- You'll need to register at http://iron.io and get your credintials to use IronWorkerNG. Each account can have unlimited number of project, so take advantage of it by creating separate projects for development, testing and production. Each project is identified by unique project_id and requiers access token to do any actions on it like uploading or queueing workers.
7
+ You'll need to register at http://iron.io/ and get your credentials to use IronWorkerNG. Each account can have an unlimited number of projects, so take advantage of it by creating separate projects for development, testing and production. Each project is identified by a unique project_id and requires your access token to do any actions on it, like uploading or queuing workers.
8
8
 
9
- Also you'll need working ruby 1.9 interpreter and IronWorkerNG gem. Install it using following command.
9
+ Also, you'll need a Ruby 1.9 interpreter and the IronWorkerNG gem. Install it using following command.
10
10
 
11
11
  ```sh
12
12
  gem install iron_worker_ng
13
13
  ```
14
14
 
15
- It's recommended that you'll install typhoeus gem as well for faster API interaction.
15
+ We recommend that you install typhoeus gem as well for faster API interaction.
16
16
 
17
17
  ```sh
18
18
  gem install typhoeus
@@ -20,7 +20,7 @@ gem install typhoeus
20
20
 
21
21
  # Creating Worker
22
22
 
23
- IronWorkerNG ruby worker is common ruby code. It can be as simple as show below and as complex as you want.
23
+ IronWorkerNG Ruby worker is common Ruby code. It can be as simple as shown below or as complex as you want.
24
24
 
25
25
  ```ruby
26
26
  puts "I'm worker"
@@ -29,7 +29,7 @@ puts "I'm executing inside #{@iron_io_project_id} and was queued using #{@iron_i
29
29
  puts "I got '#{params}' parameters"
30
30
  ```
31
31
 
32
- Everything your worker will output to stdout will be logged and available for your review when worker will finish execution.
32
+ All output to stdout will be logged and available for your review when workers finish execution.
33
33
 
34
34
  # Creating Code Package
35
35
 
@@ -50,7 +50,7 @@ Please note that this API will help you to create code package but to upload it
50
50
 
51
51
  ### initialize(name = nil)
52
52
 
53
- Will create new code package with specified name. If name is omited, camel-cased worker's file name will be used.
53
+ Will create new code package with specified name. If name is omitted, camel-cased worker's file name will be used.
54
54
 
55
55
  ```ruby
56
56
  code = IronWorkerNG::Code::Ruby.new
@@ -71,7 +71,7 @@ puts code.name
71
71
  puts code.hash_string
72
72
  ```
73
73
 
74
- Will return code package hash string. If you want prevent uploading unchanged code packages, you can use it to check if any changes were made. As it's verty efficient, it shouldn't cause any performace impact.
74
+ Will return code package hash string. If you want to prevent uploading unchanged code packages, you can use it to check if any changes were made. As it's very efficient, it shouldn't cause any performance impact.
75
75
 
76
76
  ### merge_file(path, dest = '')
77
77
 
@@ -80,11 +80,11 @@ code.merge_file '../config/database.yml' # will be in the same directory as work
80
80
  code.merge_file 'clients.csv', 'information/clients' # will be in information/clients subdirectory
81
81
  ```
82
82
 
83
- Merges file located at path into the code package. You can use optional dest to set destination directory which will be automatically created.
83
+ Merges file located at path into the code package. You can use the optional dest parameter to set destination directory which will be automatically created.
84
84
 
85
85
  ### merge_dir(path, dest = '')
86
86
 
87
- Recursively merges directory located at path into the code package.
87
+ Recursively merges the directory located at path into the code package.
88
88
 
89
89
  ```ruby
90
90
  code.merge_dir '../config' # will be in the same directory as worker
@@ -93,7 +93,7 @@ code.merge_dir 'lib', 'utils' # will be in utils subdirectory, accessible as uti
93
93
 
94
94
  ### merge_worker(path, name = nil)
95
95
 
96
- Merges worker located at path. If name is omited, camel-cased file name will be used. You can have only one worker merged per code package.
96
+ Merges worker located at path. If name is omitted, camel-cased file name will be used. You can have only one worker merged per code package.
97
97
 
98
98
  ```ruby
99
99
  code.merge_worker 'my_worker.rb' # name will be MyWorker
@@ -101,7 +101,7 @@ code.merge_worker 'my_worker.rb' # name will be MyWorker
101
101
 
102
102
  ### merge_gem(name, version = '>= 0')
103
103
 
104
- Merges gem with dependencies. Please note that gems which contains binary extensions will not be merged at the moment, however we have sane set of such gems preinstalled at IronWorker servers. You can use version constrains if you need specific gem version.
104
+ Merges gem with dependencies. Please note that gems which contains binary extensions will not be merged at the moment, however we have sane set of such gems preinstalled at IronWorker servers. You can use version constrains if you need a specific gem version.
105
105
 
106
106
  ```ruby
107
107
  code.merge_gem 'activerecord'
@@ -121,7 +121,7 @@ code.merge_gemfile '../Gemfile', 'common', 'worker' # merges gems from common an
121
121
  When you have your code package you are ready to run it on IronWorker servers.
122
122
 
123
123
  ```ruby
124
- client = IronWorkerNG::Client.new(:token => IRON_IO_TOKEN', :project_id => 'IRON_IO_PROJECT_ID')
124
+ client = IronWorkerNG::Client.new(:token => 'IRON_IO_TOKEN', :project_id => 'IRON_IO_PROJECT_ID')
125
125
 
126
126
  client.codes.create(code)
127
127
  client.tasks.create('MyWorker', {:client => 'Joe'})
@@ -129,7 +129,7 @@ client.tasks.create('MyWorker', {:client => 'Joe'})
129
129
 
130
130
  ## IronWorker::Client API
131
131
 
132
- You can use IronWorkerNG::Client API to upload code packages, queue tasks, created schedules and more.
132
+ You can use IronWorkerNG::Client API to upload code packages, queue tasks, create schedules and more.
133
133
 
134
134
  ### initialize(options = {})
135
135
 
@@ -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 information object format.
144
+ Returns an 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|
@@ -185,7 +185,7 @@ end
185
185
 
186
186
  ### codes.download(code_id, options = {})
187
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.
188
+ Downloads the 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
189
 
190
190
  ```ruby
191
191
  data = client.codes.download('1234567890')
@@ -193,7 +193,7 @@ data = client.codes.download('1234567890')
193
193
 
194
194
  ### tasks.list(options = {})
195
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.
196
+ Returns an 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
197
 
198
198
  ```ruby
199
199
  client.tasks.list.each do |task|
@@ -211,7 +211,7 @@ puts client.tasks.get('1234567890').code_name
211
211
 
212
212
  ### tasks.create(code_name, params = {}, options = {})
213
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.
214
+ Queues a 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
215
 
216
216
  ```ruby
217
217
  task = client.tasks.create('MyWorker', {:client => 'Joe'}, {:delay => 180})
@@ -220,7 +220,7 @@ puts task.id
220
220
 
221
221
  ### tasks.cancel(task_id)
222
222
 
223
- Cancels task with specified task_id.
223
+ Cancels the task with specified task_id.
224
224
 
225
225
  ```ruby
226
226
  client.tasks.cancel('1234567890')
@@ -244,7 +244,7 @@ puts client.tasks.log('1234567890')
244
244
 
245
245
  ### tasks.set_progress(task_id, options = {})
246
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.
247
+ Sets task progress information for task with specified task_id. This should be used from within workers to inform you about worker execution status which you'll get via a tasks.get call. Visit http://dev.iron.io/worker/reference/api/#set_a_tasks_progress for more information about options.
248
248
 
249
249
  ```ruby
250
250
  client.tasks.set_progress('1234567890', {:msg => 'Still running...'})
@@ -252,7 +252,7 @@ client.tasks.set_progress('1234567890', {:msg => 'Still running...'})
252
252
 
253
253
  ### tasks.wait_for(task_id, options = {})
254
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.
255
+ Waits while task identified by specified task_id executes. Options can contain :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
256
 
257
257
  ```ruby
258
258
  client.tasks.wait_for('1234567890') do |task|
@@ -262,7 +262,7 @@ end
262
262
 
263
263
  ### schedules.list(options = {})
264
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.
265
+ Returns an 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
266
 
267
267
  ```ruby
268
268
  client.schedules.list.each do |schedule|
@@ -272,7 +272,7 @@ end
272
272
 
273
273
  ### schedules.get(schedule_id)
274
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.
275
+ Returns information about the 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
276
 
277
277
  ```ruby
278
278
  puts client.schedules.get('1234567890').last_run_time
@@ -280,16 +280,16 @@ puts client.schedules.get('1234567890').last_run_time
280
280
 
281
281
  ### schedules.create(code_name, params = {}, options = {})
282
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.
283
+ Creates a 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
284
 
285
285
  ```ruby
286
286
  schedule = client.schedules.create('MyWorker', {:client => 'Joe'}, {:start_at => Time.now + 3600})
287
287
  puts schedule.id
288
288
  ```
289
289
 
290
- ### schedules.cancel(schdule_id)
290
+ ### schedules.cancel(schedule_id)
291
291
 
292
- Cancels schedule with specified schedule_id.
292
+ Cancels the schedule with specified schedule_id.
293
293
 
294
294
  ```ruby
295
295
  client.schedules.cancel('1234567890')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.14
@@ -58,6 +58,10 @@ def payload
58
58
  @payload
59
59
  end
60
60
 
61
+ def iron_worker_task_id
62
+ @iron_worker_task_id
63
+ end
64
+
61
65
  def iron_io_token
62
66
  @iron_io_token
63
67
  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: 0.1.13
4
+ version: 0.1.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-27 00:00:00.000000000 Z
13
+ date: 2012-03-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: zip
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  segments:
155
155
  - 0
156
- hash: 879145761
156
+ hash: 462212253
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  none: false
159
159
  requirements: