coderunner 0.14.20 → 0.14.21

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: 3133f820a90276cbb825f364339dce211b4a8eaa
4
- data.tar.gz: aeb2d5d11ba47ab20f463e37952e779dbb70a53e
3
+ metadata.gz: f31da7c1a3066436f1928a1e63927d1ae159c7c1
4
+ data.tar.gz: 2fbf034e17fffa91edb9f7e1b6cccb303d96d5b2
5
5
  SHA512:
6
- metadata.gz: 1abf12ee0c95e4b2d7d4c82c33d1d42a4b66cdf609dfbe117b5d79d7f0ef037212f3c44cce7f13c59ce47f7b1633ae7e02a84429dd7daf66a4e2f8e302a68405
7
- data.tar.gz: b9cb95eed51cfe9a4d20d1f8a440cbce41f1a11a4184a859a34ed115525dad5fa7bc14da0a33f903aa902abd26aa55539680ca73f4014afcd4b188edd1e50329
6
+ metadata.gz: c9210fef0749606da3dbe287e1b7ea262ae709be197eda71410b2a4f4e68c414ec1bca67c859f29b05fe302ae0634b743990ce29687e1b47d17f0730c147da37
7
+ data.tar.gz: 842086ee9b7c6e62d144bb68724b83797040bb3b6bb8a90c06102ce40baa48bb658e0c508526e79717c14f77fa52bea6da3cb02b9fb77751a74aa42a5ba1971c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.20
1
+ 0.14.21
data/coderunner.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: coderunner 0.14.20 ruby lib
5
+ # stub: coderunner 0.14.21 ruby lib
6
6
  # stub: ext/extconf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "coderunner"
10
- s.version = "0.14.20"
10
+ s.version = "0.14.21"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
@@ -335,52 +335,75 @@ EOF
335
335
  eputs "Starting launcher\n"
336
336
  at_exit{FileUtils.rm_r tl}
337
337
  FileUtils.makedirs tl
338
- Thread.new{loop{`cp #{tl}/queue_status.txt #{tl}/queue_status2.txt; ps > #{tl}/queue_status.txt`; sleep 1}}
339
-
340
- mutex = Mutex.new
341
- processes= []
342
-
343
- Thread.new do
344
- loop do
345
- Dir.entries(tl).each do |file|
346
- next unless file =~ (/(^.*)\.stop/)
347
- pid = $1
348
- mutex.synchronize{Process.kill(pid); processes.delete pid}
338
+
339
+ unless ENV['CODE_RUNNER_LAUNCHER'] =~ /serial/
340
+ Thread.new{loop{`cp #{tl}/queue_status.txt #{tl}/queue_status2.txt; ps > #{tl}/queue_status.txt`; sleep 1}}
341
+
342
+ mutex = Mutex.new
343
+ processes= []
344
+
345
+ Thread.new do
346
+ loop do
347
+ Dir.entries(tl).each do |file|
348
+ next unless file =~ (/(^.*)\.stop/)
349
+ pid = $1
350
+ mutex.synchronize{Process.kill(pid); processes.delete pid}
351
+ end
352
+ sleep refresh.to_i
353
+ end
354
+ end
355
+
356
+ #Dir.chdir(tl) do
357
+ ppid = $$
358
+ loop do
359
+ sleep refresh.to_i while processes.size >= max_queue.to_i
360
+ # processes = []
361
+ Dir.entries(tl).grep(/(^.*)\.start/).each do |file|
362
+ file =~ (/(^.*)\.start/)
363
+ id = $1
364
+ command = ""
365
+ command = File.read tl + '/' + file while command == ""
366
+ pid = fork do
367
+ processes.each do |wpid|
368
+ # Make sure all previously submitted jobs have finished.
369
+ sleep refresh.to_i while %x[ps -e -o pid,ppid].split("\n").grep(Regexp.new("^\\s*#{wpid}\\s+#{ppid}")).size > 0
370
+ end
371
+ #p ["command", command]
372
+ exec(command + "; wait")
373
+ end
374
+ `cp #{tl}/queue_status.txt #{tl}/queue_status2.txt; ps > #{tl}/queue_status.txt`
375
+ mutex.synchronize{processes.push pid}
376
+
377
+ File.open(tl + '/' + id + '.pid', 'w'){|file| file.puts pid}
378
+ FileUtils.rm(tl + '/' + file)
379
+
380
+ Thread.new{Process.wait pid; mutex.synchronize{processes.delete pid}}
381
+ end
382
+ # processes.each{|pid| Process.wait pid}
383
+ sleep refresh.to_i
384
+ end
385
+ #end
386
+ #
387
+ else
388
+ loop do
389
+ Dir.entries(tl).grep(/(^.*)\.start/).each do |file|
390
+ file =~ (/(^.*)\.start/)
391
+ id = $1
392
+ command = ""
393
+ command = File.read tl + '/' + file while command == ""
394
+ pid = 12345
395
+ File.open(tl + '/' + id + '.pid', 'w'){|file| file.puts pid}
396
+ File.open("#{tl}/queue_status.txt", "w"){|file| file.puts pid}
397
+ `cp #{tl}/queue_status.txt #{tl}/queue_status2.txt`
398
+ FileUtils.rm(tl + '/' + file)
399
+ system "#{command} \n\n wait \n\n"
400
+ File.open("#{tl}/queue_status.txt", "w"){|file| file.puts}
401
+ `cp #{tl}/queue_status.txt #{tl}/queue_status2.txt`
402
+ end
403
+ sleep refresh.to_i
349
404
  end
350
- sleep refresh.to_i
351
405
  end
352
- end
353
406
 
354
- #Dir.chdir(tl) do
355
- ppid = $$
356
- loop do
357
- sleep refresh.to_i while processes.size >= max_queue.to_i
358
- # processes = []
359
- Dir.entries(tl).grep(/(^.*)\.start/).each do |file|
360
- file =~ (/(^.*)\.start/)
361
- id = $1
362
- command = ""
363
- command = File.read tl + '/' + file while command == ""
364
- pid = fork do
365
- processes.each do |wpid|
366
- # Make sure all previously submitted jobs have finished.
367
- sleep refresh.to_i while %x[ps -e -o pid,ppid].split("\n").grep(Regexp.new("^\\s*#{wpid}\\s+#{ppid}")).size > 0
368
- end
369
- #p ["command", command]
370
- exec(command + "; wait")
371
- end
372
- `cp #{tl}/queue_status.txt #{tl}/queue_status2.txt; ps > #{tl}/queue_status.txt`
373
- mutex.synchronize{processes.push pid}
374
-
375
- File.open(tl + '/' + id + '.pid', 'w'){|file| file.puts pid}
376
- FileUtils.rm(tl + '/' + file)
377
-
378
- Thread.new{Process.wait pid; mutex.synchronize{processes.delete pid}}
379
- end
380
- # processes.each{|pid| Process.wait pid}
381
- sleep refresh.to_i
382
- end
383
- #end
384
407
  end
385
408
 
386
409
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.20
4
+ version: 0.14.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock