def inform(self,state,report): if self.active is None:return True dppath = os.path.join(tl.inmem('data'),'mcfgdata') lfu.user_data_pool_path = dppath e,zs,ax,al = self.tickets[self.active] cplan = e.cartographer_plan pplan = e.postprocess_plan for x in range(len(report)): jx,lp = report[x] ax,lp = lp if lp is None: mmap = cplan.metamap lstr = cplan._print_friendly_pspace_location(ax) ntraj = cplan.trajectory[ax].trajectory_count lp = mmap._recover_location(lstr,ntraj) else: lp.data = os.path.join(dppath,'mapdata',lp.data_pool_id) cplan._record_persistent(ax,lp) self.results[jx] = (ax,lp) pplan._enact_processes(zs,lp,arcx = ax) ncnt = self.results.count(None) perc = (1.0-float(ncnt-1)/al)*100.0 self.update_statbuff(state,'%4s percent complete',str(perc)) cplan._save_metamap() ncnt = self.results.count(None) if ncnt == 1: self.results[-1] = 'DONE' traj,pspace = cplan.trajectory,cplan.parameter_space e._output_trajectory_key(traj,pspace) let = state['lastenqueuetime'] tl.log(5,'duration of simulations',time.time()-let) tl.log(5,'performing non-0th post processing...') pstime = time.time() if pplan.use_plan:pplan._walk_processes() tl.log(5,'duration of non-0th post processes',time.time()-pstime) tl.log(5,'saving final data pool...') dpool = dba.batch_node(rnum = self.rgen.randint(10000,90000)) e._save_data_pool(dpool) tl.log(5,'saved final data pool') tl.log(5,'performing mcfg result output...') e._output() tl.log(5,'performed mcfg result output') self.update_statbuff(state,' DONE') return True
def run_mjob(state,job): ax,job = job if job is None:return ax,None f,args,drseed,dshape,ptargets = job rgen = random.Random() rgen.seed(drseed) dppath = os.path.join(tl.inmem('data'),'mcfgdata') lfu.user_data_pool_path = dppath loc_pool = dba.batch_node( metapool = True,rnum = drseed, dshape = dshape,targets = ptargets) tl.log(1,'running pspace location',ax) for x in range(dshape[0]): pseed = rgen.randint(0,sys.maxint) r = f(pseed,*args) loc_pool._trajectory(r) loc_pool._stow(v = False) loc_pool._sanitize() return ax,loc_pool