Beispiel #1
0
        def submit_worker(self,j,ce=None):
                j.backend = Ganga.GPI.LCG()
                #j.backend = Ganga.GPI.Local()
                if self.CEs != []:
                        #set the CE for a given job
                        CE = self.CEs[self.current]
                        print 'Select CE:', CE
                        j.backend.CE = CE
                        #update and normalize last CE number
                        self.current = (self.current + 1) % len(self.CEs)
                elif ce is not None:
                        j.backend.CE = ce #only if the CEs list is empty

                #call the superclass' method to set other diane-specific job settings
                Submitter.submit_worker(self,j)

                if self.options.delay:
                        print 'now sleeping for %d seconds '%self.options.delay
                        time.sleep(self.options.delay)
Beispiel #2
0
#!/usr/bin/env ganga
#-*-python-*-

if __name__ == '__main__':

    from diane.submitters import Submitter

    prog = Submitter()
    prog.download=False
    prog.parser.description = "Submit worker agents to LSF batch system. "+prog.parser.description
    prog.parser.add_option("--delay",dest="delay",type="int",default=0,help="delay in seconds in between the worker submission (to avoid spikes in the worker agent registration)")
    prog.parser.add_option("--queue",dest="queue",type="string",default='',help="set LSF queue")
    prog.parser.add_option("--extraopts",dest="extraopts",type="string",default='',help="Pass extra options to batch system Actual options depends on batch system. See GANGA Batch interface for more information.")
    prog.initialize()
    import time

    for i in range(prog.options.N_WORKERS):
        j = Job()
        j.backend=LSF(queue=prog.options.queue)
        if prog.options.extraopts:
            j.backend.extraopts = prog.options.extraopts
        prog.submit_worker(j)
        if prog.options.delay:
            print "now sleeping for %d seconds "%prog.options.delay
            time.sleep(prog.options.delay)