Method: Array#mcollect
- Defined in:
- lib/nysol/mparallel.rb
#mcollect(fn, out, nFlg = false, pclist = "/etc/pclist") ⇒ Object
outの最後が“/”でない場合は1ファイルと見なす配列にはデータがあるip,pathとが含まれている
- [ip1,path1],[ip2,path2
-
…,[ipn,pathn]]
データ量によっては端末ごとにcat&圧縮した方が高速化できるかも
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/nysol/mparallel.rb', line 34 def mcollect(fn,out,nFlg=false,pclist="/etc/pclist") fn = [fn] if fn.class != Array out = [out] if out.class != Array raise "no match size in-out " if fn.size != out.size temp=MCMD::Mtemp.new params=self.dup # PC_LIST読み込み pcM = MCMD::MpcManager.new(pclist) # ip毎に配列集約 dlist ={} params.each{|ip,path| raise "unknown ip " unless pcM.has_IP?(ip) dlist[ip] = [] unless dlist.has_key?(ip) dlist[ip] << path } (0...fn.size).each{|i| type = out[i] =~ /\/\s*$/ ? 0 : 2 type += 1 if dlist.size != 0 #パラメータセット nfr = "/#{fn[i]}" nrev = out[i] lcin = fn[i] to = out[i] if type == 3 then nrev = "#{temp.file}/" lcin = "#{nrev}*" end # collet dlist.each{|ip,path| MCMD::NetTools.recv(ip,pcM.getUIDbyIP(ip),path.maddSuffix(nfr),nrev,pcM.getPWDbyIP(ip)) } case type when 0 #出力ディレクトリ(local) MCMD::mkDir(to,true) system "cp #{lcin} #{to}" when 2,3 #出力ファイル (local) if nFlg then system "mcat i=#{lcin} o=#{to} -nfn" else system "mcat i=#{lcin} o=#{to}" end end } end |