iron_worker_ng 0.1.7 → 0.1.8
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 +7 -7
- data/VERSION +1 -1
- data/lib/iron_worker_ng/code/ruby.rb +9 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -7,10 +7,10 @@ Visit http://iron.io for more details.
|
|
7
7
|
You can just put any code into worker or can create class with name matching file name (e.g MyWorker class in my_worker.rb) and run method.
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
require 'active_record'
|
10
|
+
require 'active_record' # just in case
|
11
11
|
|
12
|
-
# @params hash is available here
|
13
12
|
# do something fun
|
13
|
+
puts params[:foo]
|
14
14
|
```
|
15
15
|
|
16
16
|
## Create Runner
|
@@ -22,7 +22,7 @@ client = IronWorkerNG::Client.new('IRON_IO_TOKEN', 'IRON_IO_PROJECT_ID')
|
|
22
22
|
|
23
23
|
code = IronWorkerNG::Code::Ruby.new
|
24
24
|
code.merge_worker 'path/to/my_worker.rb'
|
25
|
-
code.merge_gem 'activerecord'
|
25
|
+
code.merge_gem 'activerecord' # we are using it in our worker
|
26
26
|
|
27
27
|
# you can use hash_string to check if you need to reupload code
|
28
28
|
# note that hash_string check is fast while code upload can take a while (depends on how much things you merged)
|
@@ -30,7 +30,7 @@ puts code.hash_string
|
|
30
30
|
|
31
31
|
client.codes.create(code)
|
32
32
|
|
33
|
-
client.tasks.create('MyWorker',
|
33
|
+
client.tasks.create('MyWorker', :foo => 'bar')
|
34
34
|
```
|
35
35
|
|
36
36
|
## CLI
|
@@ -39,9 +39,9 @@ Iron Worker NG got nice CLI tool bundled. Here is small example how to get your
|
|
39
39
|
|
40
40
|
```sh
|
41
41
|
% cat my_worker.rb
|
42
|
-
puts "
|
42
|
+
puts "my name is #{params[:name]} and it is #{params[:it]}"
|
43
43
|
% iron_worker_ng codes.create --ruby-merge-worker my_worker.rb
|
44
|
-
% TASK_ID=`iron_worker_ng tasks.create -n MyWorker -p name,worker -p
|
44
|
+
% TASK_ID=`iron_worker_ng tasks.create -n MyWorker -p name,worker -p it,fun --print-id`
|
45
45
|
% iron_worker_ng tasks.log -t $TASK_ID --live
|
46
|
-
|
46
|
+
my name is worker and it is fun
|
47
47
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
@@ -49,6 +49,15 @@ end
|
|
49
49
|
@iron_io_project_id = parsed_payload['project_id']
|
50
50
|
@params = parsed_payload['params'] || {}
|
51
51
|
|
52
|
+
keys = @params.keys
|
53
|
+
keys.each do |key|
|
54
|
+
@params[key.to_sym] = @params[key]
|
55
|
+
end
|
56
|
+
|
57
|
+
def params
|
58
|
+
@params
|
59
|
+
end
|
60
|
+
|
52
61
|
require worker_file_name
|
53
62
|
|
54
63
|
worker_class = nil
|
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.8
|
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: 148197165
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
none: false
|
159
159
|
requirements:
|