def run_cmds (self, cmds, x = 0, ems = None) :
'''
Run conversion commands in a subprocess
cmds -> A dictionary of families that point to a list of commands.
cmds['B']['125a2ph5 -n master.ph5 ...', '1302ph5 -n master.ph5 ...']
x -> The sequence of the current command executing in the list in cmds.
ems -> The list of families ['A', 'B', 'C' etc]
'''
pees = {}
if ems == None :
ems = self.nmini
else :
ems = [ems]
#for inst in ('texan', 'rt-130', 'nodal') :
for m in ems :
if len (cmds[m]) > x :
insts = cmds[m][x]
pees[m] = subprocess.Popen (insts,
shell=True,
bufsize=-1,
cwd=os.path.join (self.home, m),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
else :
pees[m] = None
if len (ems) > 1 :
return pees, x
else :
return pees[m], x
#
### Should this be implemented as a closure?
#
评论列表
文章目录