def check_pelayouts_require_rebuild(self, models): """ Create if we require a rebuild, expects cwd is caseroot """ locked_pes = os.path.join(LOCKED_DIR, "env_mach_pes.xml") if os.path.exists(locked_pes): # Look to see if $comp_PE_CHANGE_REQUIRES_REBUILD is defined # for any component env_mach_pes_locked = EnvMachPes(infile=locked_pes, components=self.get_values("COMP_CLASSES")) for comp in models: if self.get_value("{}_PE_CHANGE_REQUIRES_REBUILD".format(comp)): # Changing these values in env_mach_pes.xml will force # you to clean the corresponding component old_tasks = env_mach_pes_locked.get_value("NTASKS_{}".format(comp)) old_threads = env_mach_pes_locked.get_value("NTHRDS_{}".format(comp)) old_inst = env_mach_pes_locked.get_value("NINST_{}".format(comp)) new_tasks = self.get_value("NTASKS_{}".format(comp)) new_threads = self.get_value("NTHRDS_{}".format(comp)) new_inst = self.get_value("NINST_{}".format(comp)) if old_tasks != new_tasks or old_threads != new_threads or old_inst != new_inst: logging.warning("{} pe change requires clean build {} {}".format(comp, old_tasks, new_tasks)) cleanflag = comp.lower() run_cmd_no_fail("./case.build --clean {}".format(cleanflag)) unlock_file("env_mach_pes.xml", self.get_value("CASEROOT"))
def _check_pelayouts_require_rebuild(case, models): ############################################################################### """ Create if we require a rebuild, expects cwd is caseroot """ locked_pes = "LockedFiles/env_mach_pes.xml" if os.path.exists(locked_pes): # Look to see if $comp_PE_CHANGE_REQUIRES_REBUILD is defined # for any component env_mach_pes_locked = EnvMachPes(infile=locked_pes) for comp in models: if case.get_value("%s_PE_CHANGE_REQUIRES_REBUILD" % comp): # Changing these values in env_mach_pes.xml will force # you to clean the corresponding component old_tasks = env_mach_pes_locked.get_value("NTASKS_%s" % comp) old_threads = env_mach_pes_locked.get_value("NTHRDS_%s" % comp) old_inst = env_mach_pes_locked.get_value("NINST_%s" % comp) new_tasks = case.get_value("NTASKS_%s" % comp) new_threads = case.get_value("NTHRDS_%s" % comp) new_inst = case.get_value("NINST_%s" % comp) if old_tasks != new_tasks or old_threads != new_threads or old_inst != new_inst: logger.warn("%s pe change requires clean build" % comp) cleanflag = comp.lower() run_cmd_no_fail("./case.build --clean %s" % cleanflag) os.remove(locked_pes)
def check_pelayouts_require_rebuild(case, models): """ Create if we require a rebuild, expects cwd is caseroot """ locked_pes = os.path.join(LOCKED_DIR, "env_mach_pes.xml") if os.path.exists(locked_pes): # Look to see if $comp_PE_CHANGE_REQUIRES_REBUILD is defined # for any component env_mach_pes_locked = EnvMachPes( infile=locked_pes, components=case.get_values("COMP_CLASSES")) for comp in models: if case.get_value("{}_PE_CHANGE_REQUIRES_REBUILD".format(comp)): # Changing these values in env_mach_pes.xml will force # you to clean the corresponding component old_tasks = env_mach_pes_locked.get_value( "NTASKS_{}".format(comp)) old_threads = env_mach_pes_locked.get_value( "NTHRDS_{}".format(comp)) old_inst = env_mach_pes_locked.get_value( "NINST_{}".format(comp)) new_tasks = case.get_value("NTASKS_{}".format(comp)) new_threads = case.get_value("NTHRDS_{}".format(comp)) new_inst = case.get_value("NINST_{}".format(comp)) if old_tasks != new_tasks or old_threads != new_threads or old_inst != new_inst: logging.warning( "{} pe change requires clean build {} {}".format( comp, old_tasks, new_tasks)) cleanflag = comp.lower() run_cmd_no_fail(
############################################################################### def _check_pelayouts_require_rebuild(case, models): ############################################################################### """ Create if we require a rebuild, expects cwd is caseroot """ locked_pes = "LockedFiles/env_mach_pes.xml" if os.path.exists(locked_pes): # Look to see if $comp_PE_CHANGE_REQUIRES_REBUILD is defined # for any component env_mach_pes_locked = EnvMachPes(infile=locked_pes) for comp in models: if case.get_value("%s_PE_CHANGE_REQUIRES_REBUILD" % comp): # Changing these values in env_mach_pes.xml will force # you to clean the corresponding component old_tasks = env_mach_pes_locked.get_value("NTASKS_%s" % comp) old_threads = env_mach_pes_locked.get_value("NTHRDS_%s" % comp) old_inst = env_mach_pes_locked.get_value("NINST_%s" % comp) new_tasks = case.get_value("NTASKS_%s" % comp) new_threads = case.get_value("NTHRDS_%s" % comp) new_inst = case.get_value("NINST_%s" % comp) if old_tasks != new_tasks or old_threads != new_threads or old_inst != new_inst: logger.warn("%s pe change requires clean build" % comp) cleanflag = comp.lower() run_cmd_no_fail("./case.build --clean %s" % cleanflag) os.remove(locked_pes)