示例#1
0
文件: bundle.py 项目: jyamu/qmc
 def bundle_jobs(self):
     jobs = []
     time = Job.zero_time()
     cores = 0
     threads = self.sims[0].job.threads
     same_threads = True
     machine_names = set()
     for sim in self.sims:
         job = sim.job
         cores += job.cores
         same_threads = same_threads and threads == job.threads
         time = job.max_time(time)
         machine = job.get_machine()
         machine_names.add(machine.name)
         jobs.append(job)
     #end for
     if not same_threads:
         self.error(
             'bundling jobs with different numbers of threads is not yet supported'
         )
     #end if
     machine_names = list(machine_names)
     if len(machine_names) != 1:
         self.error('attempted to bundle jobs across these machines: ' +
                    str(machine_names) +
                    '\n  jobs may only be bundled on the same machine')
     #end if
     self.job = Job(bundled_jobs=jobs,
                    cores=cores,
                    threads=threads,
                    machine=machine_names[0],
                    **time)
示例#2
0
 def bundle_jobs(self,relative=False):
     jobs = []
     job0 = self.sims[0].job
     time    = Job.zero_time()
     nodes   = 0
     cores   = 0
     thread_set = set()
     queue_set  = set()
     presub_set = set()
     machine_set = set()
     for sim in self.sims:
         job = sim.job
         nodes += job.nodes
         cores += job.cores
         time    = job.max_time(time)
         machine = job.get_machine()
         machine_set.add(machine.name)
         thread_set.add(job.threads)
         queue_set.add(job.queue)
         presub_set.add(job.presub)
         jobs.append(job)
     #end for
     if len(thread_set)>1:
         self.error('bundling jobs with different numbers of threads is not yet supported\nthread inputs provided: {0}'.format(sorted(thread_set),trace=False))
     #end if
     if len(queue_set)>1:
         self.error('bundling jobs with different queues is not allowed\nqueue inputs provided: {0}'.format(sorted(queue_set)),trace=False)
     #end if
     if len(presub_set)>1:
         ps = ''
         for psub in sorted(presub_set):
             ps+=psub+'\n\n'
         #end for
         self.error('bundling jobs with different pre-submission commands is not allowed\npresub inputs provided: \n{0}'.format(ps),trace=False)
     #end if
     if len(machine_set)>1:
         self.error('attempted to bundle jobs across these machines: {0}\n  jobs may only be bundled on the same machine'.format(sorted(machine_set)),trace=False)
     #end if
     threads = list(thread_set)[0]
     queue   = list(queue_set)[0]
     presub  = list(presub_set)[0]
     machine = list(machine_set)[0]
     self.job = Job(
         bundled_jobs = jobs,
         relative     = relative,
         queue        = queue,
         nodes        = nodes,
         cores        = cores,
         threads      = threads,
         machine      = machine,
         presub       = presub,
         **time
         )
示例#3
0
 def bundle_jobs(self, relative=False):
     jobs = []
     job0 = self.sims[0].job
     time = Job.zero_time()
     nodes = 0
     cores = 0
     threads = job0.threads
     queue = job0.queue
     same_threads = True
     same_queue = True
     machine_names = set()
     for sim in self.sims:
         job = sim.job
         nodes += job.nodes
         cores += job.cores
         same_threads = same_threads and threads == job.threads
         same_queue = same_queue and queue == job.queue
         time = job.max_time(time)
         machine = job.get_machine()
         machine_names.add(machine.name)
         jobs.append(job)
     #end for
     if not same_threads:
         self.error(
             'bundling jobs with different numbers of threads is not yet supported',
             trace=False)
     #end if
     if not same_queue:
         self.error('bundling jobs with different queues is not allowed',
                    trace=False)
     #end if
     machine_names = list(machine_names)
     if len(machine_names) != 1:
         self.error('attempted to bundle jobs across these machines: ' +
                    str(machine_names) +
                    '\n  jobs may only be bundled on the same machine',
                    trace=False)
     #end if
     self.job = Job(bundled_jobs=jobs,
                    relative=relative,
                    queue=queue,
                    nodes=nodes,
                    cores=cores,
                    threads=threads,
                    machine=machine_names[0],
                    **time)
示例#4
0
 def bundle_jobs(self,relative=False):
     jobs = []
     job0 = self.sims[0].job
     time    = Job.zero_time()
     nodes   = 0
     cores   = 0
     threads = job0.threads
     queue   = job0.queue
     same_threads = True
     same_queue   = True
     machine_names = set()
     for sim in self.sims:
         job = sim.job
         nodes += job.nodes
         cores += job.cores
         same_threads = same_threads and threads==job.threads
         same_queue   = same_queue   and queue==job.queue
         time    = job.max_time(time)
         machine = job.get_machine()
         machine_names.add(machine.name)
         jobs.append(job)
     #end for
     if not same_threads:
         self.error('bundling jobs with different numbers of threads is not yet supported',trace=False)
     #end if
     if not same_queue:
         self.error('bundling jobs with different queues is not allowed',trace=False)
     #end if
     machine_names = list(machine_names)
     if len(machine_names)!=1:
         self.error('attempted to bundle jobs across these machines: '+str(machine_names)+'\n  jobs may only be bundled on the same machine',trace=False)
     #end if
     self.job = Job(
         bundled_jobs = jobs,
         relative     = relative,
         queue        = queue,
         nodes        = nodes,
         cores        = cores,
         threads      = threads,
         machine      = machine_names[0],
         **time
         )