def check_inputs(self, ekey): """ Check which input files/lists do not exist """ self.start_exec_task('check_inputs') existfiles = {} ins, _ = intgmisc.get_fullnames(self.inputwcl, self.inputwcl, ekey, get_outputs=False) for sect in ins: exists, missing = intgmisc.check_files(ins[sect]) existfiles[sect] = exists if missing: for mfile in missing: miscutils.fwdebug_print( f"ERROR: input '{mfile}' does not exist.", WRAPPER_OUTPUT_PREFIX) os.system("pwd") os.system("find . -type f") sys.exit(3) #raise IOError("At least one input file not found.") # if missing inputs, just abort self.end_exec_task(0) return existfiles
def check_inputs(self, ekey): """ Check which input files/lists do not exist Parameters ---------- ekey : str The section of the WCL to look in. Returns ------- list The input files that were found. """ self.start_exec_task('check_inputs') existfiles = {} ins, _ = intgmisc.get_fullnames(self.inputwcl, self.inputwcl, ekey) for sect in ins: exists, missing = intgmisc.check_files(ins[sect]) existfiles[sect] = exists if missing: for mfile in missing: miscutils.fwdebug_print( "ERROR: input '%s' does not exist." % mfile, WRAPPER_OUTPUT_PREFIX) os.system("pwd") os.system("find . -type f") sys.exit(3) #raise IOError("At least one input file not found.") # if missing inputs, just abort self.end_exec_task(0) return existfiles
def check_outputs(self, ekey, exitcode): """ Check which output files were created, renaming if necessary """ if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("INFO: Beg", WRAPPER_OUTPUT_PREFIX) self.start_exec_task('check_outputs') existfiles = {} missingfiles = {} _, outs = intgmisc.get_fullnames(self.inputwcl, self.inputwcl, ekey) for sect in outs: if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print(f"INFO: sect={sect}", WRAPPER_OUTPUT_PREFIX) exists, missing = intgmisc.check_files(outs[sect]) existfiles.update({sect: exists}) if missing: optout = self.get_optout(sect) if optout: if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print( f"\tINFO: optional output file '{missing}' does not exist (sect: {sect}).", WRAPPER_OUTPUT_PREFIX) elif exitcode != 0: if miscutils.fwdebug_check(6, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print( f"INFO: skipping missing output due to non-zero exit code ({sect}: {missing})", WRAPPER_OUTPUT_PREFIX) else: miscutils.fwdebug_print( f"ERROR: Missing required output file(s) ({sect}:{missing})", WRAPPER_OUTPUT_PREFIX) missingfiles.update({sect: missing}) if miscutils.fwdebug_check(6, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print(f"INFO: existfiles={existfiles}", WRAPPER_OUTPUT_PREFIX) miscutils.fwdebug_print(f"INFO: missingfiles={missingfiles}", WRAPPER_OUTPUT_PREFIX) if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("INFO: end", WRAPPER_OUTPUT_PREFIX) if missingfiles: status = 1 else: status = 0 self.end_exec_task(status) return existfiles
def check_outputs(self, ekey, exitcode): """ Check which output files were created, renaming if necessary Parameters ---------- ekey : str The exec section to use from the WCL exitcode : int The exit code of the executable run Returns ------- dict Dictionary containing the files that exist and some descriptor information """ if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("INFO: Beg", WRAPPER_OUTPUT_PREFIX) self.start_exec_task('check_outputs') existfiles = {} missingfiles = {} _, outs = intgmisc.get_fullnames(self.inputwcl, self.inputwcl, ekey) for sect in outs: if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("INFO: sect=%s" % sect, WRAPPER_OUTPUT_PREFIX) exists, missing = intgmisc.check_files(outs[sect]) existfiles.update({sect: exists}) if missing: optout = self.get_optout(sect) if optout: if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("\tINFO: optional output file '%s' does not exist (sect: %s)." % \ (missing, sect), WRAPPER_OUTPUT_PREFIX) elif exitcode != 0: if miscutils.fwdebug_check(6, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print( "INFO: skipping missing output due to non-zero exit code (%s: %s)" % (sect, missing), WRAPPER_OUTPUT_PREFIX) else: miscutils.fwdebug_print( "ERROR: Missing required output file(s) (%s:%s)" % (sect, missing), WRAPPER_OUTPUT_PREFIX) missingfiles.update({sect: missing}) if miscutils.fwdebug_check(6, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("INFO: existfiles=%s" % existfiles, WRAPPER_OUTPUT_PREFIX) miscutils.fwdebug_print("INFO: missingfiles=%s" % missingfiles, WRAPPER_OUTPUT_PREFIX) if miscutils.fwdebug_check(3, 'BASICWRAP_DEBUG'): miscutils.fwdebug_print("INFO: end", WRAPPER_OUTPUT_PREFIX) if missingfiles: status = 1 else: status = 0 self.end_exec_task(status) return existfiles