iron_worker_ng 0.15.3 → 0.16.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: e4a144b9e59731f576c1b8ee52493c648c02b8c5
4
- data.tar.gz: 57c5f272f39ddee7f62404ea424d8b3fabd8f7f5
3
+ metadata.gz: cdb0ecf4cb31bca3a74ab9058eac4f192d3aaf51
4
+ data.tar.gz: dcdcf1d49ae382b24b4ea39db51601b7829c9071
5
5
  SHA512:
6
- metadata.gz: a92229c173e9e85e6d40d2561c17f3f90e375f821886a66782b8b1357fa4542b3414be5c9bcefa5006f4eb971a63c9314e229c4075c3157b5dbbc2c997f97710
7
- data.tar.gz: baf4c4cbc869c5055106f406f743983c5cdf3f2f5240dd4263d6c04b6c9d5013d9d9efe9ead886e1d0190f1bcbddf4db1b1c47d460907e4fd93dad467d780d2a
6
+ metadata.gz: 197caf385e658a094d013ab318196888497d24d0a5aa86252fa8928e50fd1fd922e04cd13ffffaab637f79fe0fe102cc7e62270a6ea5951d1927de2bc3fd23c5
7
+ data.tar.gz: 8318b65292c4c6a417e20578d9d1e4b41f8f321b42dab6f3fcd72abc6a30ccdf1bbd95b47985527315ca75a58064cffcd4eb63e1a1951521792b979de5fc8fa4
data/README.md CHANGED
@@ -26,7 +26,7 @@ the following is an acceptable worker:
26
26
 
27
27
  ```ruby
28
28
  puts "Hello Worker!"
29
- puts "My task_id is #{@iron_worker_task_id}"
29
+ puts "My task_id is #{@iron_task_id}"
30
30
  puts "I got '#{params}' parameters"
31
31
  ```
32
32
 
@@ -351,7 +351,7 @@ Merge a pip package with dependencies. If any pip package contains native extens
351
351
 
352
352
  ```ruby
353
353
  code.merge_pip 'iron_mq'
354
- code.merge_pip 'iron_worker', '0.2'
354
+ code.merge_pip 'iron_worker', '==0.2'
355
355
  ```
356
356
 
357
357
  # Upload Your Worker
@@ -221,10 +221,10 @@ root() {
221
221
 
222
222
  cd "$(root "$@")"
223
223
 
224
- LD_LIBRARY_PATH=.:./__debs__/usr/lib:./__debs__/usr/lib/x86_64-linux-gnu:./__debs__/lib:./__debs__/lib/x86_64-linux-gnu
224
+ LD_LIBRARY_PATH=.:./lib:./__debs__/usr/lib:./__debs__/usr/lib/x86_64-linux-gnu:./__debs__/lib:./__debs__/lib/x86_64-linux-gnu
225
225
  export LD_LIBRARY_PATH
226
226
 
227
- PATH=.:./__debs__/usr/bin:./__debs__/bin:$PATH
227
+ PATH=.:./bin:./__debs__/usr/bin:./__debs__/bin:$PATH
228
228
  export PATH
229
229
 
230
230
  #{runtime_run_code(local)}
@@ -10,7 +10,7 @@ module IronWorkerNG
10
10
 
11
11
  def runtime_run_code(local = false)
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)} "$@"
14
14
  RUN_CODE
15
15
  end
16
16
  end
@@ -17,23 +17,42 @@ module IronWorkerNG
17
17
  def bundle(container)
18
18
  IronCore::Logger.debug 'IronWorkerNG', "Bundling pip dependencies"
19
19
 
20
- tmp_dir_name = ::Dir.tmpdir + '/' + ::Dir::Tmpname.make_tmpname('iron-worker-ng-', 'pips')
20
+ pip_dir_name = ::Dir.tmpdir + '/' + ::Dir::Tmpname.make_tmpname('iron-worker-ng-', 'pip')
21
21
 
22
- ::Dir.mkdir(tmp_dir_name)
23
- ::Dir.mkdir(tmp_dir_name + '/bin')
24
- ::Dir.mkdir(tmp_dir_name + '/lib')
22
+ ::Dir.mkdir(pip_dir_name)
25
23
 
26
- deps_string = @deps.map { |dep| dep.version == '' ? dep.name : dep.name + '==' + dep.version }.join(' ')
27
- install_command = 'pip install --ignore-installed --install-option="--prefix=' + tmp_dir_name + '" ' + deps_string
24
+ p = 'pip-1.3.1'
25
+ `cd #{pip_dir_name} && curl -O https://pypi.python.org/packages/source/p/pip/#{p}.tar.gz && tar xf #{p}.tar.gz && cd #{p} && python setup.py install --root #{pip_dir_name} && rm -rf #{p} #{p}.tar.gz`
28
26
 
29
- system(install_command)
27
+ local = File.exists?(pip_dir_name + '/usr/local/lib') ? 'local' : ''
30
28
 
31
- packages_dir = Dir.glob(tmp_dir_name + '/lib/*python*').first + '/site-packages'
29
+ pip_packages_dir = Dir.glob(pip_dir_name + '/usr/' + local + '/lib/*python*').first
32
30
 
33
- container_add(container, '__pips__/bin', tmp_dir_name + '/bin', true)
34
- container_add(container, '__pips__', packages_dir , true)
31
+ deps_string = @deps.map { |dep| dep.version == '' ? dep.name : dep.name + dep.version }.join(' ')
32
+ install_command = pip_dir_name + '/usr/' + local + '/bin/pip install --user -U -I ' + deps_string
35
33
 
36
- FileUtils.rm_rf(tmp_dir_name)
34
+ fork do
35
+ ENV['PYTHONPATH'] = pip_packages_dir + '/site_packages:' + pip_packages_dir + '/dist-packages'
36
+ puts `#{install_command}`
37
+ end
38
+
39
+ Process.wait
40
+
41
+ pips_packages_dir = Dir.glob(ENV['HOME'] + '/.local/lib/*python*').first
42
+
43
+ if File.exists?(ENV['HOME'] + '/.local/bin')
44
+ container_add(container, '__pips__/__bin__', ENV['HOME'] + '/.local/bin', true)
45
+ end
46
+
47
+ if File.exists?(pips_packages_dir + '/site-packages')
48
+ container_add(container, '__pips__', pips_packages_dir + '/site-packages' , true)
49
+ end
50
+
51
+ if File.exists?(pips_packages_dir + '/dist-packages')
52
+ container_add(container, '__pips__', pips_packages_dir + '/dist-packages' , true)
53
+ end
54
+
55
+ FileUtils.rm_rf(pip_dir_name)
37
56
  end
38
57
  end
39
58
  end
@@ -1,5 +1,5 @@
1
1
  module IronWorkerNG
2
- VERSION = '0.15.3'
2
+ VERSION = '0.16.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: 0.15.3
4
+ version: 0.16.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: 2013-03-07 00:00:00.000000000 Z
12
+ date: 2013-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iron_core