coderunner 0.14.20 → 0.14.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/coderunner.gemspec +2 -2
- data/lib/coderunner/class_methods.rb +66 -43
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f31da7c1a3066436f1928a1e63927d1ae159c7c1
|
4
|
+
data.tar.gz: 2fbf034e17fffa91edb9f7e1b6cccb303d96d5b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9210fef0749606da3dbe287e1b7ea262ae709be197eda71410b2a4f4e68c414ec1bca67c859f29b05fe302ae0634b743990ce29687e1b47d17f0730c147da37
|
7
|
+
data.tar.gz: 842086ee9b7c6e62d144bb68724b83797040bb3b6bb8a90c06102ce40baa48bb658e0c508526e79717c14f77fa52bea6da3cb02b9fb77751a74aa42a5ba1971c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.14.
|
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.
|
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.
|
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
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
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
|
|