Class: MCMD::MparallelManagerByFile
- Inherits:
-
MparallelManager
- Object
- MparallelManager
- MCMD::MparallelManagerByFile
- Defined in:
- lib/nysol/mparallelmanager.rb
Instance Method Summary collapse
- #addNo(no, lane) ⇒ Object
-
#getLane(wait = true) ⇒ Object
空き実行レーン取得.
-
#initialize(mp = 16, wrk = "./", tim = -1)) ⇒ MparallelManagerByFile
constructor
A new instance of MparallelManagerByFile.
-
#runStateCheker ⇒ Object
メモリ,CPUチェッカー.
- #waitall ⇒ Object
-
#waitLane ⇒ Object
ファイルでプロセス終了確認.
Methods inherited from MparallelManager
Constructor Details
#initialize(mp = 16, wrk = "./", tim = -1)) ⇒ MparallelManagerByFile
Returns a new instance of MparallelManagerByFile.
233 234 235 236 |
# File 'lib/nysol/mparallelmanager.rb', line 233 def initialize(mp=16,wrk="./",tim=-1) super(mp,tim) @wrk =wrk end |
Instance Method Details
#addNo(no, lane) ⇒ Object
272 273 274 275 276 277 278 |
# File 'lib/nysol/mparallelmanager.rb', line 272 def addNo (no,lane) if @mtx then @mtx.synchronize { @runpid[no]=lane } else @runpid[no]=lane end end |
#getLane(wait = true) ⇒ Object
空き実行レーン取得
282 283 284 285 |
# File 'lib/nysol/mparallelmanager.rb', line 282 def getLane(wait=true) waitLane if wait and @LaneQue.empty? return @LaneQue.shift end |
#runStateCheker ⇒ Object
メモリ,CPUチェッカー
288 289 290 |
# File 'lib/nysol/mparallelmanager.rb', line 288 def runStateCheker #何もしない end |
#waitall ⇒ Object
292 293 294 295 296 297 298 |
# File 'lib/nysol/mparallelmanager.rb', line 292 def waitall rtn = [] while !@runpid.empty? or !@slppid.empty? do rtn.concat(waitLane) end return rtn end |
#waitLane ⇒ Object
ファイルでプロセス終了確認
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/nysol/mparallelmanager.rb', line 240 def waitLane finLane =[] loop{ bFlg = false # @runpid [No->lane]] @runpid.each{|k,v| next unless File.exist?("#{@wrk}/#{v}.log") jmpF =false File.open("#{@wrk}/#{v}.log"){|fp| lin=fp.gets if lin == nil then MCMD::msgLog("UNMATCH FORMAT LOG #{@wrk}/#{v}.log") jmpF = true elsif lin.split[1].to_i != k then MCMD::msgLog("UNMATCH NUMBER #{@wrk}/#{v}.log #{k}") jmpF = true end } next if jmpF finLane.push(v) @LaneQue.push(v) if @runpid.delete(k) == nil then MCMD::msgLog("NIL FIND NIL FIND") end File.unlink("#{@wrk}/#{v}.log") bFlg = true } break if bFlg } return finLane end |