def run_resume(self): config.load(os.path.join(config.latest_link_file, config.config_file_name)) fridge.get_all_from_disk(config.work_dir) with open(config.failure_file) as failure_f: last_stage = int(failure_f.readline()) config.dynamic('stage', last_stage) self.run_stages()
def run_resume(self): config.load( os.path.join(config.latest_link_file, config.config_file_name)) fridge.get_all_from_disk(config.work_dir) with open(config.failure_file) as failure_f: last_stage = int(failure_f.readline()) config.dynamic('stage', last_stage) self.run_stages()
def run_new(self): # prevent accidental early start assert self.__is_ready # make some space to work in, and a pointer to it os.makedirs(config.work_dir) try: os.remove(config.latest_link_file) except OSError: pass os.symlink(config.work_dir, config.latest_link_file) config.dynamic('stage', 0) self.run_stages()
def run_stages(self): config.log_to_file(config.log_file) logger.info('BEGIN') while config.stage < len(self.__stages): stage = self.__stages[config.stage] try: logger.info('running {.__name__}'.format(stage)) stage() except: logger.error('error---saving state') with open(config.failure_file, 'w') as failure_f: print >> failure_f, config.stage #logger.error(traceback.format_exc()) config.dump(config.config_file) raise config.dynamic('stage', config.stage + 1)
def run_stages(self): config.log_to_file(config.log_file) logger.info('BEGIN') while config.stage < len(self.__stages): stage = self.__stages[config.stage] try: logger.info('running {.__name__}'.format(stage)) stage() except: logger.error('error---saving state') with open(config.failure_file, 'w') as failure_f: print >>failure_f, config.stage #logger.error(traceback.format_exc()) config.dump(config.config_file) raise config.dynamic('stage', config.stage + 1)