iron_worker_ng 1.3.0 → 1.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f20b9ca4a077f85f1563aec6717c34c6cea05c73
4
- data.tar.gz: 76087c46464e1a34801836c610cccd4b992a8e48
3
+ metadata.gz: 85db46574b1c476ce867a7ca7a911fc82214e8a5
4
+ data.tar.gz: 51df9666082d05c5c52792661002ee1989e9cf03
5
5
  SHA512:
6
- metadata.gz: 22cf54ee8a8860a336d8f538935ea08ad691717971f75c125008f4c9823cf88afe83861aa9fe4fad2fb1b0056dfecb21efde564f7ba1ccde60d28b1f701aa3e8
7
- data.tar.gz: 4bb3824f9ee9cbe790808127090f966bed1c90e4bae5829366f0ab3552de09cc32e79731fcfe7d20137b7e54fed1eb021aad248378f8e9d488c7f93c1a4e82b8
6
+ metadata.gz: 4e4fa53b7adb5072f254a7d0ed107cfc91ac9ebae29180bec6d9d9ec8474115d30760dcaea1a596492c853e5ea14c3f586c793a5b6b4118f7b34c362378a5294
7
+ data.tar.gz: db9e43bf9d46b5c482f0b671b162747c49d198ae195c943f04f3383acb79468ed022277d816e357559b9d953670af4037d4ea1c4767f3549c56fd83ddd66da3b
data/README.md CHANGED
@@ -411,6 +411,32 @@ for as many tasks as you want.
411
411
  client.tasks.create('MyWorker', {:client => 'Joe'})
412
412
  ```
413
413
 
414
+ # Stacks
415
+ Stack is a docker image based on ubuntu + some custom software(ruby/python/mono/java...)
416
+ You can use different stacks to launch your tasks.
417
+ To get list of available stacks you could do:
418
+
419
+ ```ruby
420
+ client.stacks_list
421
+ ```
422
+
423
+ or using cli
424
+
425
+ ```sh
426
+ iron_worker stacks
427
+ ```
428
+
429
+ And to specify stack add following line in your .worker file
430
+
431
+ ```ruby
432
+ # define the runtime language, this can be ruby, java, node, php, go, etc.
433
+ runtime 'binary'
434
+ stack 'java-1.7'
435
+ exec 'java.sh'
436
+ ```
437
+
438
+
439
+
414
440
  # The Rest of the IronWorker API
415
441
 
416
442
  ## IronWorker::Client
data/bin/iron_worker CHANGED
@@ -41,7 +41,7 @@ if $*.size == 1 && ($*[0] == '-v' || $*[0] == '--version')
41
41
  exit 0
42
42
  end
43
43
 
44
- commands = ['upload', 'patch', 'queue', 'retry', 'schedule', 'log', 'run', 'install', 'webhook', 'info']
44
+ commands = ['upload', 'patch', 'queue', 'retry', 'schedule', 'log', 'run', 'install', 'webhook', 'info', 'stacks']
45
45
 
46
46
  if $*.size == 0 || (not commands.include?($*[0]))
47
47
  puts 'usage: iron_worker COMMAND [OPTIONS]'
@@ -445,4 +445,7 @@ elsif command == 'info'
445
445
 
446
446
  @cli.info_schedule($*[0], params, options)
447
447
  end
448
- end
448
+
449
+ elsif command == 'stacks'
450
+ @cli.stacks_list
451
+ end
@@ -30,6 +30,10 @@ module IronWorkerNG
30
30
  super + @api_version.to_s + '/'
31
31
  end
32
32
 
33
+ def stacks_list
34
+ parse_response(get("stacks"))
35
+ end
36
+
33
37
  def codes_list(options = {})
34
38
  parse_response(get("projects/#{@project_id}/codes", options))
35
39
  end
@@ -64,6 +64,12 @@ module IronWorkerNG
64
64
  @client
65
65
  end
66
66
 
67
+ def stacks_list
68
+ client
69
+ log_group "List of available stacks"
70
+ print client.stacks_list
71
+ end
72
+
67
73
  def upload(name, params, options)
68
74
  client
69
75
 
@@ -53,6 +53,11 @@ module IronWorkerNG
53
53
  end
54
54
  end
55
55
 
56
+ def stacks_list
57
+ @api.stacks_list
58
+ end
59
+
60
+
56
61
  def codes_list(options = {})
57
62
  IronCore::Logger.debug 'IronWorkerNG', "Calling codes.list with options='#{options.to_s}'"
58
63
 
@@ -24,6 +24,7 @@ module IronWorkerNG
24
24
  attr_accessor :zip_package
25
25
 
26
26
  attr_accessor :use_local_iron_worker_ng
27
+ attr_accessor :fix_params
27
28
 
28
29
  undef exec
29
30
  undef gem
@@ -216,7 +217,7 @@ module IronWorkerNG
216
217
  def runtime_bundle(container, local = false)
217
218
  end
218
219
 
219
- def runtime_run_code(local = false)
220
+ def runtime_run_code(local, params)
220
221
  ''
221
222
  end
222
223
 
@@ -226,6 +227,12 @@ module IronWorkerNG
226
227
  end
227
228
 
228
229
  if local || ((not remote_build_command) && (not full_remote_build))
230
+ params = "\"$@\""
231
+
232
+ if @fix_params
233
+ params="-`echo \"$@\" | sed \"s/ -/ --/g\"`"
234
+ end
235
+
229
236
  container.get_output_stream(@dest_dir + '__runner__.sh') do |runner|
230
237
  runner.write <<RUNNER
231
238
  #!/bin/sh
@@ -252,7 +259,7 @@ export PATH
252
259
 
253
260
  #{container.runner_additions}
254
261
 
255
- #{runtime_run_code(local)}
262
+ #{runtime_run_code(local, params)}
256
263
  RUNNER
257
264
  end
258
265
 
@@ -4,11 +4,11 @@ module IronWorkerNG
4
4
  module Binary
5
5
  include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
6
6
 
7
- def runtime_run_code(local = false)
7
+ def runtime_run_code(local, params)
8
8
  <<RUN_CODE
9
9
  chmod +x #{File.basename(@exec.path)}
10
10
 
11
- #{File.basename(@exec.path)} "$@"
11
+ #{File.basename(@exec.path)} #{params}
12
12
  RUN_CODE
13
13
  end
14
14
  end
@@ -4,9 +4,9 @@ module IronWorkerNG
4
4
  module Go
5
5
  include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
6
6
 
7
- def runtime_run_code(local = false)
7
+ def runtime_run_code(local, params)
8
8
  <<RUN_CODE
9
- go run #{File.basename(@exec.path)} "$@"
9
+ go run #{File.basename(@exec.path)} #{params}
10
10
  RUN_CODE
11
11
  end
12
12
  end
@@ -7,7 +7,7 @@ module IronWorkerNG
7
7
  include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
8
8
  include IronWorkerNG::Feature::Java::MergeJar::InstanceMethods
9
9
 
10
- def runtime_run_code(local = false)
10
+ def runtime_run_code(local, params)
11
11
  classpath_array = []
12
12
 
13
13
  classpath_array << @exec.path
@@ -23,7 +23,7 @@ module IronWorkerNG
23
23
  IronCore::Logger.info 'IronWorkerNG', "Collected '#{classpath}' classpath"
24
24
 
25
25
  <<RUN_CODE
26
- java -cp #{classpath} #{@exec.arg(:class, 0).nil? ? "-jar #{File.basename(@exec.path)}" : @exec.arg(:class, 0)} "$@"
26
+ java -cp #{classpath} #{@exec.arg(:class, 0).nil? ? "-jar #{File.basename(@exec.path)}" : @exec.arg(:class, 0)} #{params}
27
27
  RUN_CODE
28
28
  end
29
29
  end
@@ -4,9 +4,9 @@ module IronWorkerNG
4
4
  module Mono
5
5
  include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
6
6
 
7
- def runtime_run_code(local = false)
7
+ def runtime_run_code(local, params)
8
8
  <<RUN_CODE
9
- mono #{File.basename(@exec.path)} "$@"
9
+ mono #{File.basename(@exec.path)} #{params}
10
10
  RUN_CODE
11
11
  end
12
12
  end
@@ -36,9 +36,9 @@ NODE_RUNNER
36
36
  end
37
37
  end
38
38
 
39
- def runtime_run_code(local = false)
39
+ def runtime_run_code(local, params)
40
40
  <<RUN_CODE
41
- node #{File.basename(@exec.path)} "$@"
41
+ node #{File.basename(@exec.path)} #{params}
42
42
  RUN_CODE
43
43
  end
44
44
  end
@@ -4,9 +4,9 @@ module IronWorkerNG
4
4
  module Perl
5
5
  include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
6
6
 
7
- def runtime_run_code(local = false)
7
+ def runtime_run_code(local, params)
8
8
  <<RUN_CODE
9
- perl #{File.basename(@exec.path)} "$@"
9
+ perl #{File.basename(@exec.path)} #{params}
10
10
  RUN_CODE
11
11
  end
12
12
  end
@@ -62,9 +62,9 @@ PHP_RUNNER
62
62
  end
63
63
  end
64
64
 
65
- def runtime_run_code(local = false)
65
+ def runtime_run_code(local, params)
66
66
  <<RUN_CODE
67
- TERM=dumb php __runner__.php "$@"
67
+ TERM=dumb php __runner__.php #{params}
68
68
  RUN_CODE
69
69
  end
70
70
  end
@@ -8,9 +8,9 @@ module IronWorkerNG
8
8
  include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods
9
9
  include IronWorkerNG::Feature::Python::MergePipDependency::InstanceMethods
10
10
 
11
- def runtime_run_code(local = false)
11
+ def runtime_run_code(local, params)
12
12
  <<RUN_CODE
13
- PATH=`pwd`/__pips__/__bin__:$PATH PYTHONPATH=`pwd`/__pips__ python -u #{File.basename(@exec.path)} "$@"
13
+ PATH=`pwd`/__pips__/__bin__:$PATH PYTHONPATH=`pwd`/__pips__ python -u #{File.basename(@exec.path)} #{params}
14
14
  RUN_CODE
15
15
  end
16
16
  end
@@ -116,9 +116,9 @@ RUBY_RUNNER
116
116
  end
117
117
  end
118
118
 
119
- def runtime_run_code(local = false)
119
+ def runtime_run_code(local, params)
120
120
  <<RUN_CODE
121
- ruby __runner__.rb "$@"
121
+ ruby __runner__.rb #{params}
122
122
  RUN_CODE
123
123
  end
124
124
 
@@ -1,5 +1,5 @@
1
1
  module IronWorkerNG
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
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.3.0
4
+ version: 1.4.0
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-02-27 00:00:00.000000000 Z
12
+ date: 2014-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iron_core
@@ -175,48 +175,48 @@ extra_rdoc_files: []
175
175
  files:
176
176
  - lib/3rdparty/hashie/indifferent_access.rb
177
177
  - lib/3rdparty/hashie/merge_initializer.rb
178
- - lib/iron_worker_ng/fetcher.rb
179
- - lib/iron_worker_ng/compat.rb
178
+ - lib/iron_worker_ng/api_client.rb
179
+ - lib/iron_worker_ng/cli.rb
180
180
  - 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
181
  - lib/iron_worker_ng/code/base.rb
182
+ - lib/iron_worker_ng/code/binary.rb
183
+ - lib/iron_worker_ng/code/builder.rb
184
+ - lib/iron_worker_ng/code/container/base.rb
185
+ - lib/iron_worker_ng/code/container/dir.rb
186
+ - lib/iron_worker_ng/code/container/zip.rb
187
+ - lib/iron_worker_ng/code/go.rb
187
188
  - lib/iron_worker_ng/code/java.rb
188
- - lib/iron_worker_ng/code/runtime/python.rb
189
- - lib/iron_worker_ng/code/runtime/ruby.rb
189
+ - lib/iron_worker_ng/code/mono.rb
190
+ - lib/iron_worker_ng/code/node.rb
191
+ - lib/iron_worker_ng/code/perl.rb
192
+ - lib/iron_worker_ng/code/php.rb
193
+ - lib/iron_worker_ng/code/python.rb
194
+ - lib/iron_worker_ng/code/ruby.rb
195
+ - lib/iron_worker_ng/code/runtime/binary.rb
196
+ - lib/iron_worker_ng/code/runtime/go.rb
197
+ - lib/iron_worker_ng/code/runtime/java.rb
190
198
  - lib/iron_worker_ng/code/runtime/mono.rb
191
199
  - lib/iron_worker_ng/code/runtime/node.rb
192
- - lib/iron_worker_ng/code/runtime/java.rb
193
200
  - lib/iron_worker_ng/code/runtime/perl.rb
194
- - lib/iron_worker_ng/code/runtime/binary.rb
195
201
  - lib/iron_worker_ng/code/runtime/php.rb
196
- - lib/iron_worker_ng/code/runtime/go.rb
197
- - lib/iron_worker_ng/code/perl.rb
198
- - lib/iron_worker_ng/code/builder.rb
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
202
+ - lib/iron_worker_ng/code/runtime/python.rb
203
+ - lib/iron_worker_ng/code/runtime/ruby.rb
204
+ - lib/iron_worker_ng/compat.rb
205
205
  - lib/iron_worker_ng/feature/base.rb
206
+ - lib/iron_worker_ng/feature/common/merge_deb.rb
207
+ - lib/iron_worker_ng/feature/common/merge_dir.rb
208
+ - lib/iron_worker_ng/feature/common/merge_exec.rb
209
+ - lib/iron_worker_ng/feature/common/merge_file.rb
210
+ - lib/iron_worker_ng/feature/common/merge_zip.rb
211
+ - lib/iron_worker_ng/feature/common/set_env.rb
212
+ - lib/iron_worker_ng/feature/java/merge_jar.rb
206
213
  - lib/iron_worker_ng/feature/python/merge_pip.rb
207
214
  - 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
215
  - lib/iron_worker_ng/feature/ruby/merge_gem.rb
216
+ - lib/iron_worker_ng/feature/ruby/merge_gem_dependency.rb
211
217
  - lib/iron_worker_ng/feature/ruby/merge_gemfile.rb
212
- - lib/iron_worker_ng/feature/common/set_env.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/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
218
+ - lib/iron_worker_ng/fetcher.rb
219
+ - lib/iron_worker_ng/version.rb
220
220
  - lib/iron_worker_ng.rb
221
221
  - README.md
222
222
  - LICENSE