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.
- checksums.yaml +4 -4
- data/lib/pampa.rb +12 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b1459066c689c6e0da9b34d03bca2ed26f4bf590c0b8f06f8763bd7538dc87
|
4
|
+
data.tar.gz: aaf7d7cf00dea424b8e068b4740b50af04b0696bee6b441ab82f41753f825bd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
397
|
-
|
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
|
-
|
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... ")
|