Exemplo n.º 1
0
    def prepare(self):
        global pbs_dirt
        if self.name:
            nscripts = len(self.scripts)

            inode = 0
            ijob = 0
            j = 1

            names = []
            nodescripts = []
            for i in range(len(self.scripts)):
                nodescripts.append(self.scripts[i])

                if j == self.ipn or i == len(self.scripts) - 1:
                    scriptname = self.name + '-%02d-%02d' % (ijob, inode)
                    names.append(scriptname)

                    file = open('%s/SConstruct-%s' % (pbs_dirt, scriptname),
                                'w')
                    file.write('from rsf.proj import *\n')
                    sconsign = '%s.sconsign.dbhash' % scriptname
                    file.write( \
'''
import dbhash 	 
proj = Project()
proj.SConsignFile("%s",dbhash)	 
''' % (sconsign))

                    self.sconsign.append(sconsign)

                    for tscript in nodescripts:
                        file.write(tscript)
                        file.write('\n')

                    file.write('End()\n')
                    file.close()

                    inode += 1
                    j = 1
                    nodescripts = []
                else:
                    j += 1

                if inode == self.nodes or i == len(self.scripts) - 1:
                    jobname = self.name + '-%02d' % ijob
                    file = open('%s/%s-shell' % (pbs_dirt, jobname), 'w')
                    file.write(
                        string.join([
                            'scons -f %s/SConstruct-%s' % (pbs_dirt, name)
                            for name in names
                        ], '\n'))
                    file.close()
                    ijob += 1
                    if i == len(self.scripts) - 1 and inode != self.nodes:
                        self.nnl = inode
                    inode = 0
                    names = []
                    self.all.append(jobname)
Exemplo n.º 2
0
    def prepare(self):
        global pbs_dirt
        if self.name:
            sconsign = '%s.sconsign.dbhash' % self.name
            self.sconsign.append(sconsign)
            self.all = [self.name]
            file = open('%s/SConstruct-%s' % (pbs_dirt,self.name),'w')
            file.write('from rsf.proj import *\n')
            file.write( \
'''
import dbhash  
proj = Project()
proj.SConsignFile("%s",dbhash)	 
''' % (sconsign))
            file.write(string.join(self.tasks,'\n'))
            file.write('\n')
            file.write('End()\n')
            file.close()