def read_xml(self): if (len(self._env_files_that_need_rewrite) > 0): files = "" for env_file in self._env_files_that_need_rewrite: files += " " + env_file.filename expect( False, "Object(s) %s seem to have newer data than the corresponding case file" % files) self._env_entryid_files = [] self._env_entryid_files.append(EnvCase(self._caseroot, components=None)) components = self._env_entryid_files[0].get_values("COMP_CLASSES") self._env_entryid_files.append( EnvRun(self._caseroot, components=components)) self._env_entryid_files.append( EnvBuild(self._caseroot, components=components)) self._env_entryid_files.append( EnvMachPes(self._caseroot, components=components)) if os.path.isfile(os.path.join(self._caseroot, "env_test.xml")): self._env_entryid_files.append( EnvTest(self._caseroot, components=components)) self._env_generic_files = [] self._env_generic_files.append(EnvBatch(self._caseroot)) self._env_generic_files.append(EnvMachSpecific(self._caseroot)) self._env_generic_files.append(EnvArchive(self._caseroot)) self._files = self._env_entryid_files + self._env_generic_files
def case_st_archive(case): ############################################################################### """ Create archive object and perform short term archiving """ caseroot = case.get_value("CASEROOT") dout_s_root = case.get_value('DOUT_S_ROOT') if dout_s_root is None or dout_s_root == 'UNSET': expect(False, 'XML variable DOUT_S_ROOT is required for short-term achiver') if not isdir(dout_s_root): os.makedirs(dout_s_root) dout_s_save_interim = case.get_value('DOUT_S_SAVE_INTERIM_RESTART_FILES') if dout_s_save_interim == 'FALSE' or dout_s_save_interim == 'UNSET': rest_n = case.get_value('REST_N') stop_n = case.get_value('STOP_N') if rest_n < stop_n: logger.warn('Restart files from end of run will be saved' 'interim restart files will be deleted') logger.info("st_archive starting") # do short-term archiving append_status("st_archiving starting", caseroot=caseroot, sfile="CaseStatus") archive = EnvArchive(infile=os.path.join(caseroot, 'env_archive.xml')) _archive_process(case, archive) append_status("st_archiving completed", caseroot=caseroot, sfile="CaseStatus") logger.info("st_archive completed") # resubmit case if appropriate resubmit = case.get_value("RESUBMIT") if resubmit > 0: append_status("resubmitting from st_archive", caseroot=caseroot, sfile="CaseStatus") logger.info("resubmitting from st_archive, resubmit=%d" % resubmit) if case.get_value("MACH") == "mira": expect(os.path.isfile(".original_host"), "ERROR alcf host file not found") with open(".original_host", "r") as fd: sshhost = fd.read() run_cmd("ssh cooleylogin1 ssh %s '%s/case.submit %s --resubmit' "\ %(sshhost, caseroot, caseroot), verbose=True) else: submit(case, resubmit=True)
expect(False, 'XML variable DOUT_S_ROOT is required for short-term achiver') if not isdir(dout_s_root): os.makedirs(dout_s_root) dout_s_save_interim = case.get_value('DOUT_S_SAVE_INTERIM_RESTART_FILES') if dout_s_save_interim == 'FALSE' or dout_s_save_interim == 'UNSET': rest_n = case.get_value('REST_N') stop_n = case.get_value('STOP_N') if rest_n < stop_n: logger.warn('Restart files from end of run will be saved' 'interim restart files will be deleted') logger.info("st_archive starting") archive = EnvArchive(infile=os.path.join(caseroot, 'env_archive.xml')) functor = lambda: _archive_process(case, archive) run_and_log_case_status(functor, "st_archive", caseroot=caseroot) logger.info("st_archive completed") # resubmit case if appropriate resubmit = case.get_value("RESUBMIT") if resubmit > 0 and not no_resubmit: logger.info("resubmitting from st_archive, resubmit=%d" % resubmit) if case.get_value("MACH") == "mira": expect(os.path.isfile(".original_host"), "ERROR alcf host file not found") with open(".original_host", "r") as fd: sshhost = fd.read() run_cmd("ssh cooleylogin1 ssh %s '%s/case.submit %s --resubmit' "\