pampa 2.0.9 → 2.0.11

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pampa.rb +12 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad3879f199bd25c70d8813a8f6e9ee35392eb53806efb6501ac170c9032e9f76
4
- data.tar.gz: 81b3dff09c975dd450e992d99f79e2a07ab5207c5a1ccf51ac461cfdae244bf3
3
+ metadata.gz: f6b1459066c689c6e0da9b34d03bca2ed26f4bf590c0b8f06f8763bd7538dc87
4
+ data.tar.gz: aaf7d7cf00dea424b8e068b4740b50af04b0696bee6b441ab82f41753f825bd1
5
5
  SHA512:
6
- metadata.gz: '0180f41fd431073ee8a401889926339fa71fedf8b7472d7a1a08f237b25623ca23ddb047c80446593394beaf629782ccc1f0ceab38dc7e29716fd0e774ba10f2'
7
- data.tar.gz: b7e672e0b09709f89541dffad2f6a420bebdffc8e17733e17b67becfb4334c415b465e65662175b5482473cc0bbfaecfe5adece05c5392a6075930b271d2e382
6
+ metadata.gz: 144e90f7f7cc71ddd8ceccf2dc52327e0a859ba59569108c14d6f4b925193dd3471f1809a6fbe602b9b073aa19ad9af470bd6acd139901c33dd1c399b3d2c205
7
+ data.tar.gz: 566d553a3798a5b74c4c10ff17e24cb5099eedcb1cb038369f4e7c7d4652fc0d5392474c8b39c70eb354d0a0b0e4c609343c822c68641945f5d7daba49ee3ac2
data/lib/pampa.rb CHANGED
@@ -326,25 +326,25 @@ module BlackStack
326
326
  l.done
327
327
  # kill all ruby processes except this one
328
328
  l.logs("Killing all Ruby processes except this one... ")
329
- node.exec("ps ax | grep ruby | grep -v grep | grep -v #{Process.pid} | cut -b3-7 | xargs -t kill;", false)
329
+ `ps ax | grep ruby | grep -v grep | grep -v #{Process.pid} | cut -b3-7 | xargs -t kill;`
330
330
  l.done
331
331
  # rename any existing folder ~/code/pampa to ~/code/pampa.<current timestamp>.
332
332
  l.logs("Renaming old folder... ")
333
- node.exec('mv ~/pampa ~/pampa.'+Time.now().to_i.to_s, false)
333
+ `mv ~/pampa ~/pampa.#{Time.now().to_i.to_s}`
334
334
  l.done
335
335
  # create a new folder ~/code. - ignore if it already exists.
336
336
  l.logs("Creating new folder... ")
337
- node.exec('mkdir ~/pampa', false)
337
+ `mkdir ~/pampa`
338
338
  l.done
339
339
  # build the file ~/pampa/config.rb in the remote node. - Be sure the BlackStack::Pampa.to_hash.to_s don't have single-quotes (') in the string.
340
340
  l.logs("Building config file... ")
341
341
  s = "echo \"#{File.read(config_filename)}\" > ~/pampa/config.rb"
342
- node.exec(s, false)
342
+ `#{s}`
343
343
  l.done
344
344
  # copy the file ~/pampa/worker.rb to the remote node. - Be sure the script don't have single-quotes (') in the string.
345
345
  l.logs("Copying worker file... ")
346
346
  s = "echo \"#{File.read(worker_filename)}\" > ~/pampa/worker.rb"
347
- node.exec(s, false)
347
+ `#{s}`
348
348
  l.done
349
349
  # run the number of workers specified in the configuration of the Pampa module.
350
350
  node.workers.each { |worker|
@@ -352,7 +352,7 @@ module BlackStack
352
352
  # add these parameters for debug: debug=yes pampa=~/code/pampa/lib/pampa.rb
353
353
  l.logs "Running worker #{worker.id}... "
354
354
  s = "nohup ruby worker.rb id=#{worker.id} config=~/pampa/config.rb >/dev/null 2>&1 &"
355
- node.exec(s, false)
355
+ `#{s}`
356
356
  l.done
357
357
  }
358
358
  # disconnect the node
@@ -368,7 +368,7 @@ module BlackStack
368
368
  # run the number of workers specified in the configuration of the Pampa module.
369
369
  # return an array with the IDs of the workers.
370
370
  #
371
- def self.start()
371
+ def self.start(config_filename='~/pampa/config.rb', worker_filename='~/pampa/worker.rb')
372
372
  # validate: the connection string is not nil
373
373
  raise "The connection string is nil" if @@connection_string.nil?
374
374
  # validate: the connection string is not empty
@@ -386,15 +386,16 @@ module BlackStack
386
386
  l.done
387
387
  # kill all ruby processes except this one
388
388
  l.logs("Killing all Ruby processes except this one... ")
389
- node.exec("ps ax | grep ruby | grep -v grep | grep -v #{Process.pid} | cut -b3-7 | xargs -t kill;", false)
389
+ `ps ax | grep ruby | grep -v grep | grep -v #{Process.pid} | cut -b3-7 | xargs -t kill;`
390
390
  l.done
391
391
  # run the number of workers specified in the configuration of the Pampa module.
392
392
  node.workers.each { |worker|
393
393
  # run the worker
394
394
  # add these parameters for debug: debug=yes pampa=~/code/pampa/lib/pampa.rb
395
395
  l.logs "Running worker #{worker.id}... "
396
- s = "nohup ruby worker.rb id=#{worker.id} config=~/pampa/config.rb >/dev/null 2>&1 &"
397
- node.exec(s, false)
396
+ s = "nohup ruby #{worker_filename} id=#{worker.id} config=#{config_filename} >/dev/null 2>&1 &"
397
+ binding.pry
398
+ `#{s}`
398
399
  l.done
399
400
  }
400
401
  # disconnect the node
@@ -429,7 +430,7 @@ module BlackStack
429
430
  l.done
430
431
  # kill all ruby processes except this one
431
432
  l.logs("Killing all Ruby processes except this one... ")
432
- node.exec("ps ax | grep ruby | grep -v grep | grep -v #{Process.pid} | cut -b3-7 | xargs -t kill;", false)
433
+ `ps ax | grep ruby | grep -v grep | grep -v #{Process.pid} | cut -b3-7 | xargs -t kill;`
433
434
  l.done
434
435
  # disconnect the node
435
436
  l.logs("Disconnecting... ")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pampa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi