iron_worker_ng 1.5.2 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a654f4e22e048d2a9812b02b4355704b5f6c6670
4
- data.tar.gz: 4ed6669f27699dcd3f4ca51f91e2a07dd124c454
3
+ metadata.gz: ec003beb156fbb334b0a0d1447742f434457e000
4
+ data.tar.gz: dd390f78a508f82c0a6b5c909ea2015063ff1af0
5
5
  SHA512:
6
- metadata.gz: 02beee3cc652603989da4eba6005c3ec9ee9f9adcf4738289c85fca859bfd51bd8f8592b7ee25575f5ad7dd8ddc0e7e0395446cf24f14ec97da42e25f7e13ec2
7
- data.tar.gz: 166cbabf5dcb22a8e2116c3970c7a7b3e230c89af887fcca8058e9ceac130d7caaff3231c49ab3aeee5e361ef1b15889ae33f55c33922cabf0a8c350df5d91b2
6
+ metadata.gz: 5e89a774dc83290bc649b438b33d208bf5073d94fe8cab027a43bfff3858b10a3a23e0dcf584939e3d06625f7da59f60f4be9e4fcce0f1e7d4981597a6a808e9
7
+ data.tar.gz: fbbfde46222f1178b00cc6338592bb7dd4c07f6c87c8f630e11082c72180f2d492d007db24207f6f0c1728bc2e26fcbf2a179abd5015765c09caac0ddb09d94b
data/README.md CHANGED
@@ -43,7 +43,8 @@ supplementary data, and other dependencies with it. `.worker` files make it easy
43
43
 
44
44
  ```ruby
45
45
  # define the runtime language, this can be ruby, java, node, php, go, etc.
46
- runtime "ruby"
46
+ # also you could set version of language(check of available versions via iron_worker stacks)
47
+ runtime "ruby","2.1"
47
48
  # exec is the file that will be executed:
48
49
  exec "hello_worker.rb"
49
50
  ```
@@ -90,7 +91,7 @@ You can specify priority of the task using `--priority` parameter:
90
91
 
91
92
  ```ruby
92
93
  iron_worker queue hello --priority 0 # default value, lowest priority
93
- iron_worker queue hello --priority 1 # medium priority
94
+ iron_worker queue hello --priority 1 --label 'medium priority task' # medium priority
94
95
  ```
95
96
 
96
97
  Value of priority parameter means the priority queue to run the task in. Valid values are 0, 1, and 2. 0 is the default.
@@ -108,6 +109,7 @@ You can specify not only priority:
108
109
  - **priority**: Setting the priority of your job. Valid values are 0, 1, and 2. The default is 0.
109
110
  - **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
111
  - **delay**: The number of seconds to delay before actually queuing the task. Default is 0.
112
+ - **label**: Optional text label for your task.
111
113
 
112
114
  ## Get task status
113
115
 
@@ -437,7 +439,12 @@ iron_worker stacks
437
439
  And to specify stack add following line in your .worker file
438
440
 
439
441
  ```ruby
440
- # define the runtime language, this can be ruby, java, node, php, go, etc.
442
+ runtime 'ruby', '2.1'
443
+ ```
444
+ Or
445
+
446
+ ```ruby
447
+ exec 'java.sh'
441
448
  runtime 'binary'
442
449
  stack 'java-1.7'
443
450
  exec 'java.sh'
@@ -603,7 +610,7 @@ puts client.schedules.get('1234567890').last_run_time
603
610
  Create a new scheduled task for the code package specified by `code_name`, passing the params hash to it as a data payload and returning a scheduled task object with only the `id` field filled. Visit http://dev.iron.io/worker/reference/api/#schedule_a_task for more information about the available options.
604
611
 
605
612
  ```ruby
606
- schedule = client.schedules.create('MyWorker', {:client => 'Joe'}, {:start_at => Time.now + 3600})
613
+ schedule = client.schedules.create('MyWorker', {:client => 'Joe'}, {:start_at => Time.now + 3600, :run_every =>60, :priority => 0, :run_times => 100, :end_at: Time.now + 2592000, Time.now + 84600})
607
614
  puts schedule.id
608
615
  ```
609
616
 
data/bin/iron_worker CHANGED
@@ -184,6 +184,11 @@ elsif command == 'queue' || command == 'schedule'
184
184
  options[:cluster] = v
185
185
  end
186
186
 
187
+ desc = command == 'queue' ? 'task' : 'schedule'
188
+ opts.on('--label LABEL', String, "Label #{desc} with given name") do |v|
189
+ options[:label] = v
190
+ end
191
+
187
192
  if command == 'queue'
188
193
  opts.on('--wait', Integer, 'wait for task to complete and print log') do |v|
189
194
  options[:wait] = true
@@ -211,9 +216,6 @@ elsif command == 'queue' || command == 'schedule'
211
216
  options[:run_every] = v
212
217
  end
213
218
 
214
- opts.on('--label LABEL', String, 'Label schedule with given name') do |v|
215
- options[:label] = v
216
- end
217
219
  end
218
220
 
219
221
  common_opts(opts)
@@ -294,6 +294,7 @@ module IronWorkerNG
294
294
  data << ['code package', task.code_name]
295
295
  data << ['code revision', task.code_rev]
296
296
  data << ['status', task.status]
297
+ data << ['label', task.label] if task.label
297
298
  data << ['priority', task.priority || 2]
298
299
  data << ['queued', parse_time(task.created_at) || '-']
299
300
  data << ['started', parse_time(task.start_time) || '-']
@@ -179,7 +179,7 @@ module IronWorkerNG
179
179
  @full_remote_build = true
180
180
  end
181
181
 
182
- def runtime(runtime = nil)
182
+ def runtime(runtime = nil, version = nil)
183
183
  return @runtime unless runtime
184
184
 
185
185
  unless @runtime.nil?
@@ -189,6 +189,12 @@ module IronWorkerNG
189
189
  runtime_module = nil
190
190
  runtime = runtime.to_s
191
191
 
192
+ if version
193
+ s = "#{runtime}-#{version}"
194
+ IronCore::Logger.info 'IronWorkerNG', "Trying to set stack to:#{s}'"
195
+ stack(s)
196
+ end
197
+
192
198
  begin
193
199
  runtime_module = IronWorkerNG::Code::Runtime.const_get(runtime.capitalize)
194
200
  rescue
@@ -1,6 +1,6 @@
1
- require 'zip/zip'
1
+ require 'zip'
2
2
 
3
- Zip.options[:continue_on_exists_proc] = true
3
+ Zip.continue_on_exists_proc = true
4
4
 
5
5
  module IronWorkerNG
6
6
  module Code
@@ -10,7 +10,7 @@ module IronWorkerNG
10
10
  super
11
11
 
12
12
  @name = @name + '.zip'
13
- @zip = ::Zip::ZipFile.open(@name, ::Zip::ZipFile::CREATE)
13
+ @zip = ::Zip::File.open(@name, ::Zip::File::CREATE)
14
14
  end
15
15
 
16
16
  def add(dest, src)
@@ -22,7 +22,7 @@ module IronWorkerNG
22
22
  ::Dir.mkdir(tmp_dir_name)
23
23
 
24
24
  IronWorkerNG::Fetcher.fetch_to_file(rebase(@path)) do |zip|
25
- zipf = ::Zip::ZipFile.open(zip)
25
+ zipf = ::Zip::File.open(zip)
26
26
  zipf.restore_permissions = true
27
27
 
28
28
  zipf.each do |f|
@@ -1,5 +1,5 @@
1
1
  module IronWorkerNG
2
- VERSION = '1.5.2'
2
+ VERSION = '1.6.1'
3
3
 
4
4
  def self.version
5
5
  VERSION
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.2
4
+ version: 1.6.1
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: 2014-11-10 00:00:00.000000000 Z
12
+ date: 2014-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iron_core
@@ -43,16 +43,16 @@ dependencies:
43
43
  name: rubyzip
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 0.9.9
48
+ version: 1.0.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.9.9
55
+ version: 1.0.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: test-unit
58
58
  requirement: !ruby/object:Gem::Requirement