iron_worker_ng 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/bin/iron_worker +14 -1
- data/lib/iron_worker_ng/cli.rb +2 -0
- data/lib/iron_worker_ng/code/runtime/node.rb +14 -1
- data/lib/iron_worker_ng/code/runtime/ruby.rb +7 -3
- data/lib/iron_worker_ng/version.rb +1 -1
- metadata +59 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b0e4d4aa270911d8fb351eef0d9f699bed21645
|
4
|
+
data.tar.gz: d375f5157a3eccac3a39291f8ebcdba23e7bcfd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c312b4699081f8f2f1da4f5ee39dba3c097e5bc1e5c2deb3d7cf3d540610e5c399a29f80d935abdb3cddbe1e70928e43b6c7fb526358e593b2e8301f6a540473
|
7
|
+
data.tar.gz: 89e486619760f5b0720b966fada3e623a08ed428dc6f1d1d7d43c5469dcbfdcb69c6e6a24b11a3297573f4207a981278453df36faecb3669e7bf6fc6f19a3fd4
|
data/README.md
CHANGED
@@ -101,6 +101,14 @@ From code you can set the priority like it done in snippet below:
|
|
101
101
|
client.tasks.create("hello", some_params, priority: 2) # highest priority
|
102
102
|
```
|
103
103
|
|
104
|
+
### Setting additional Options
|
105
|
+
|
106
|
+
You can specify not only priority:
|
107
|
+
|
108
|
+
- **priority**: Setting the priority of your job. Valid values are 0, 1, and 2. The default is 0.
|
109
|
+
- **timeout**: The maximum runtime of your task in seconds. No task can exceed 3600 seconds (60 minutes). The default is 3600 but can be set to a shorter duration.
|
110
|
+
- **delay**: The number of seconds to delay before actually queuing the task. Default is 0.
|
111
|
+
|
104
112
|
## Get task status
|
105
113
|
|
106
114
|
When you call `iron_worker queue X`, you'll see the task ID in the output which you can use to get the status.
|
@@ -599,6 +607,19 @@ schedule = client.schedules.create('MyWorker', {:client => 'Joe'}, {:start_at =>
|
|
599
607
|
puts schedule.id
|
600
608
|
```
|
601
609
|
|
610
|
+
#### Scheduling Options
|
611
|
+
|
612
|
+
- **run_every**: The amount of time, in seconds, between runs. By default, the task will only run once. run_every will return a 400 error if it is set to less than 60.
|
613
|
+
- **end_at**: The time tasks will stop being queued.
|
614
|
+
- **run_times**: The number of times a task will run.
|
615
|
+
- **priority**: Setting the priority of your job. Valid values are 0, 1, and 2. The default is 0. Higher values means tasks spend less time in the queue once they come off the schedule.
|
616
|
+
- **start_at**: The time the scheduled task should first be run.
|
617
|
+
- **timeout**: The maximum runtime of your task in seconds. No task can exceed 3600 seconds (60 minutes). The default is 3600 but can be set to a shorter duration.
|
618
|
+
- **delay**: The number of seconds to delay before scheduling the tasks. Default is 0.
|
619
|
+
- **task_delay**: The number of seconds to delay before actually queuing the task. Default is 0.
|
620
|
+
- **label**: Optional label for adding custom labels to scheduled tasks.
|
621
|
+
- **cluster**: cluster name ex: "high-mem" or "dedicated". This is a premium feature for customers to have access to more powerful or custom built worker solutions. Dedicated worker clusters exist for users who want to reserve a set number of workers just for their queued tasks. If not set default is set to "default" which is the public IronWorker cluster.
|
622
|
+
|
602
623
|
### schedules.cancel(schedule_id)
|
603
624
|
|
604
625
|
Cancel the scheduled task specified by `schedule_id`.
|
data/bin/iron_worker
CHANGED
@@ -73,6 +73,10 @@ if command == 'upload'
|
|
73
73
|
options[:max_concurrency] = v
|
74
74
|
end
|
75
75
|
|
76
|
+
opts.on('-p', '--default-priority DEFAULT_PRIORITY', Integer, 'default priority of the tasks') do |v|
|
77
|
+
options[:default_priority] = v
|
78
|
+
end
|
79
|
+
|
76
80
|
opts.on('-r', '--retries NUM_RETRIES', Integer, 'max number of automatic retries on task fail') do |v|
|
77
81
|
options[:retries] = v
|
78
82
|
end
|
@@ -171,7 +175,8 @@ elsif command == 'queue' || command == 'schedule'
|
|
171
175
|
options[:timeout] = v
|
172
176
|
end
|
173
177
|
|
174
|
-
|
178
|
+
desc = command == 'queue' ? 'delay before start in seconds' : 'delay before scheduling tasks in seconds'
|
179
|
+
opts.on('--delay DELAY', Integer, desc) do |v|
|
175
180
|
options[:delay] = v
|
176
181
|
end
|
177
182
|
|
@@ -186,6 +191,10 @@ elsif command == 'queue' || command == 'schedule'
|
|
186
191
|
end
|
187
192
|
|
188
193
|
if command == 'schedule'
|
194
|
+
opts.on('--task-delay DELAY', Integer, 'delay before start of task in seconds') do |v|
|
195
|
+
options[:task_delay] = v
|
196
|
+
end
|
197
|
+
|
189
198
|
opts.on('--start-at TIME', 'start task at specified time') do |v|
|
190
199
|
options[:start_at] = Time.parse(v)
|
191
200
|
end
|
@@ -201,6 +210,10 @@ elsif command == 'queue' || command == 'schedule'
|
|
201
210
|
opts.on('--run-every RUN_EVERY', Integer, 'run task every RUN_EVERY seconds') do |v|
|
202
211
|
options[:run_every] = v
|
203
212
|
end
|
213
|
+
|
214
|
+
opts.on('--label LABEL', String, 'Label schedule with given name') do |v|
|
215
|
+
options[:label] = v
|
216
|
+
end
|
204
217
|
end
|
205
218
|
|
206
219
|
common_opts(opts)
|
data/lib/iron_worker_ng/cli.rb
CHANGED
@@ -83,6 +83,7 @@ module IronWorkerNG
|
|
83
83
|
|
84
84
|
log "Code package name is '#{code.name}'"
|
85
85
|
log "Max concurrency set to '#{options[:max_concurrency]}'" unless options[:max_concurrency].nil?
|
86
|
+
log "Default priority set to '#{options[:default_priority]}'" unless options[:default_priority].nil?
|
86
87
|
log "Retries set to '#{options[:retries]}'" unless options[:retries].nil?
|
87
88
|
log "Retries delay set to '#{options[:retries_delay]}'" unless options[:retries_delay].nil?
|
88
89
|
log "Host set to '#{options[:host]}'" unless options[:host].nil?
|
@@ -299,6 +300,7 @@ module IronWorkerNG
|
|
299
300
|
data << ['id', schedule._id]
|
300
301
|
data << ['code package', schedule.code_name]
|
301
302
|
data << ['status', schedule.status]
|
303
|
+
data << ['label', schedule.label] if schedule.label
|
302
304
|
data << ['created', parse_time(schedule.created_at) || '-']
|
303
305
|
data << ['next start', parse_time(schedule.next_start) || '-']
|
304
306
|
data << ['run count', schedule.run_count || '-']
|
@@ -10,13 +10,26 @@ module IronWorkerNG
|
|
10
10
|
/* #{IronWorkerNG.full_version} */
|
11
11
|
|
12
12
|
var fs = require('fs');
|
13
|
+
var querystring = require('querystring');
|
13
14
|
var params = null;
|
14
15
|
var task_id = null;
|
15
16
|
var config = null;
|
16
17
|
|
17
18
|
process.argv.forEach(function(val, index, array) {
|
18
19
|
if (val == "-payload") {
|
19
|
-
params =
|
20
|
+
params = fs.readFileSync(process.argv[index + 1], 'utf8');
|
21
|
+
try {
|
22
|
+
params = JSON.parse(params);
|
23
|
+
} catch(e) {
|
24
|
+
try {
|
25
|
+
var parsed = querystring.parse(params);
|
26
|
+
if (!(Object.keys(parsed).length == 1 && parsed[Object.keys(parsed)[0]] == '')) {
|
27
|
+
params = parsed
|
28
|
+
}
|
29
|
+
} catch(e) {
|
30
|
+
|
31
|
+
}
|
32
|
+
}
|
20
33
|
}
|
21
34
|
|
22
35
|
if (val == "-config") {
|
@@ -63,18 +63,22 @@ if config_file
|
|
63
63
|
@config = File.read(config_file)
|
64
64
|
begin
|
65
65
|
@config = JSON.parse(@config)
|
66
|
-
@config = IronWorkerNGHash.new(@config)
|
66
|
+
@config = IronWorkerNGHash.new(@config) if @config.is_a?(::Hash)
|
67
67
|
rescue
|
68
68
|
# try yaml
|
69
69
|
begin
|
70
70
|
@config = YAML.load(@config)
|
71
|
-
@config = IronWorkerNGHash.new(@config)
|
71
|
+
@config = IronWorkerNGHash.new(@config) if @config.is_a?(::Hash)
|
72
72
|
rescue
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
|
77
|
+
if params.is_a?(::Hash)
|
78
|
+
@params = IronWorkerNGHash.new(params)
|
79
|
+
else
|
80
|
+
@params = params
|
81
|
+
end
|
78
82
|
|
79
83
|
def payload
|
80
84
|
@payload
|
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.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kirilenko
|
@@ -9,34 +9,34 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 1.0.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 1.0.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
@@ -57,112 +57,112 @@ dependencies:
|
|
57
57
|
name: test-unit
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: minitest
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- -
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: minitest-reporters
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- -
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 0.5.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 0.5.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rake
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: twitter
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- -
|
123
|
+
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: actionmailer
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
type: :development
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: iron_cache
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- -
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: 1.4.0
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- -
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: 1.4.0
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: go
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- -
|
158
|
+
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
|
-
- -
|
165
|
+
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
168
|
description: New generation ruby client for IronWorker
|
@@ -173,54 +173,54 @@ executables:
|
|
173
173
|
extensions: []
|
174
174
|
extra_rdoc_files: []
|
175
175
|
files:
|
176
|
+
- LICENSE
|
177
|
+
- README.md
|
178
|
+
- bin/iron_worker
|
176
179
|
- lib/3rdparty/hashie/indifferent_access.rb
|
177
180
|
- lib/3rdparty/hashie/merge_initializer.rb
|
178
|
-
- lib/iron_worker_ng
|
179
|
-
- lib/iron_worker_ng/
|
181
|
+
- lib/iron_worker_ng.rb
|
182
|
+
- lib/iron_worker_ng/api_client.rb
|
183
|
+
- lib/iron_worker_ng/cli.rb
|
180
184
|
- lib/iron_worker_ng/client.rb
|
181
|
-
- lib/iron_worker_ng/version.rb
|
182
|
-
- lib/iron_worker_ng/code/python.rb
|
183
|
-
- lib/iron_worker_ng/code/ruby.rb
|
184
|
-
- lib/iron_worker_ng/code/mono.rb
|
185
|
-
- lib/iron_worker_ng/code/node.rb
|
186
185
|
- lib/iron_worker_ng/code/base.rb
|
186
|
+
- lib/iron_worker_ng/code/binary.rb
|
187
|
+
- lib/iron_worker_ng/code/builder.rb
|
188
|
+
- lib/iron_worker_ng/code/container/base.rb
|
189
|
+
- lib/iron_worker_ng/code/container/dir.rb
|
190
|
+
- lib/iron_worker_ng/code/container/zip.rb
|
191
|
+
- lib/iron_worker_ng/code/go.rb
|
187
192
|
- lib/iron_worker_ng/code/java.rb
|
188
|
-
- lib/iron_worker_ng/code/
|
189
|
-
- lib/iron_worker_ng/code/
|
193
|
+
- lib/iron_worker_ng/code/mono.rb
|
194
|
+
- lib/iron_worker_ng/code/node.rb
|
195
|
+
- lib/iron_worker_ng/code/perl.rb
|
196
|
+
- lib/iron_worker_ng/code/php.rb
|
197
|
+
- lib/iron_worker_ng/code/python.rb
|
198
|
+
- lib/iron_worker_ng/code/ruby.rb
|
199
|
+
- lib/iron_worker_ng/code/runtime/binary.rb
|
200
|
+
- lib/iron_worker_ng/code/runtime/go.rb
|
201
|
+
- lib/iron_worker_ng/code/runtime/java.rb
|
190
202
|
- lib/iron_worker_ng/code/runtime/mono.rb
|
191
203
|
- lib/iron_worker_ng/code/runtime/node.rb
|
192
|
-
- lib/iron_worker_ng/code/runtime/java.rb
|
193
204
|
- lib/iron_worker_ng/code/runtime/perl.rb
|
194
|
-
- lib/iron_worker_ng/code/runtime/binary.rb
|
195
205
|
- lib/iron_worker_ng/code/runtime/php.rb
|
196
|
-
- lib/iron_worker_ng/code/runtime/
|
197
|
-
- lib/iron_worker_ng/code/
|
198
|
-
- lib/iron_worker_ng/
|
199
|
-
- lib/iron_worker_ng/code/binary.rb
|
200
|
-
- lib/iron_worker_ng/code/container/zip.rb
|
201
|
-
- lib/iron_worker_ng/code/container/dir.rb
|
202
|
-
- lib/iron_worker_ng/code/container/base.rb
|
203
|
-
- lib/iron_worker_ng/code/php.rb
|
204
|
-
- lib/iron_worker_ng/code/go.rb
|
206
|
+
- lib/iron_worker_ng/code/runtime/python.rb
|
207
|
+
- lib/iron_worker_ng/code/runtime/ruby.rb
|
208
|
+
- lib/iron_worker_ng/compat.rb
|
205
209
|
- lib/iron_worker_ng/feature/base.rb
|
210
|
+
- lib/iron_worker_ng/feature/common/merge_deb.rb
|
211
|
+
- lib/iron_worker_ng/feature/common/merge_dir.rb
|
212
|
+
- lib/iron_worker_ng/feature/common/merge_exec.rb
|
213
|
+
- lib/iron_worker_ng/feature/common/merge_file.rb
|
214
|
+
- lib/iron_worker_ng/feature/common/merge_zip.rb
|
215
|
+
- lib/iron_worker_ng/feature/common/set_env.rb
|
216
|
+
- lib/iron_worker_ng/feature/java/merge_jar.rb
|
206
217
|
- lib/iron_worker_ng/feature/python/merge_pip.rb
|
207
218
|
- lib/iron_worker_ng/feature/python/merge_pip_dependency.rb
|
208
|
-
- lib/iron_worker_ng/feature/java/merge_jar.rb
|
209
|
-
- lib/iron_worker_ng/feature/ruby/merge_gem_dependency.rb
|
210
219
|
- lib/iron_worker_ng/feature/ruby/merge_gem.rb
|
220
|
+
- lib/iron_worker_ng/feature/ruby/merge_gem_dependency.rb
|
211
221
|
- lib/iron_worker_ng/feature/ruby/merge_gemfile.rb
|
212
|
-
- lib/iron_worker_ng/
|
213
|
-
- lib/iron_worker_ng/
|
214
|
-
- lib/iron_worker_ng/feature/common/merge_zip.rb
|
215
|
-
- lib/iron_worker_ng/feature/common/merge_deb.rb
|
216
|
-
- lib/iron_worker_ng/feature/common/merge_dir.rb
|
217
|
-
- lib/iron_worker_ng/feature/common/merge_exec.rb
|
218
|
-
- lib/iron_worker_ng/cli.rb
|
219
|
-
- lib/iron_worker_ng/api_client.rb
|
220
|
-
- lib/iron_worker_ng.rb
|
221
|
-
- README.md
|
222
|
-
- LICENSE
|
223
|
-
- bin/iron_worker
|
222
|
+
- lib/iron_worker_ng/fetcher.rb
|
223
|
+
- lib/iron_worker_ng/version.rb
|
224
224
|
homepage: https://github.com/iron-io/iron_worker_ruby_ng
|
225
225
|
licenses: []
|
226
226
|
metadata: {}
|
@@ -230,17 +230,17 @@ require_paths:
|
|
230
230
|
- lib
|
231
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
232
232
|
requirements:
|
233
|
-
- -
|
233
|
+
- - ">="
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '1.9'
|
236
236
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
237
|
requirements:
|
238
|
-
- -
|
238
|
+
- - ">="
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: 1.3.6
|
241
241
|
requirements: []
|
242
242
|
rubyforge_project:
|
243
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.2.2
|
244
244
|
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: New generation ruby client for IronWorker
|