def correct(self): actions = list() backup(self.archivelist) actions.append("Archived files %s" % self.archivelist) for myfile in self.archivelist: if (not myfile in self.copyfromlist) and ( not myfile in self.copytolist ): #if it is a copy-from, don't want to delete it, and if it is a copy-to, it will be either overwritted by a copy-from file, or preserved if os.path.isfile(myfile): os.remove(myfile) for myfile in self.copyfromlist: cindex = self.copyfromlist.index(myfile) if os.path.isfile(myfile): if os.stat(myfile).st_size > 0: os.rename(myfile, self.copytolist[cindex]) actions.append( "Copied file %s to %s" % (self.copyfromlist[cindex], self.copytolist[cindex])) else: actions.append( "Skipped file copy of %s to %s because %s was empty." % (self.copyfromlist[cindex], self.copytolist[cindex], self.copyfromlist[cindex])) else: actions.append( "Skipped file copy of %s to %s because %s did not exist." % (self.copyfromlist[cindex], self.copytolist[cindex], self.copyfromlist[cindex])) return {"errors": ["MAST VASP at NSW error"], "actions": actions}
def correct(self): actions=list() multiplier = 4 if 'mast_nodes' in self.keywords['program_keys'].keys(): currnodes = self.keywords['program_keys']['mast_nodes'] newnodes = int(currnodes) * multiplier self.keywords['program_keys']['mast_nodes'] = newnodes actions.append("Multiplied mast_nodes by %i to get %i" % (multiplier, newnodes)) if 'mast_processors' in self.keywords['program_keys'].keys(): currprocs = self.keywords['program_keys']['mast_processors'] newprocs = int(currprocs) * multiplier self.keywords['program_keys']['mast_processors'] = newprocs actions.append("Multiplied mast_processors by %i to get %i" % (multiplier, newprocs)) script_commands.write_submit_script(self.keywords) actions.append("Wrote new submission script.") #archive old files. But, for insufficient virtual memory, not worth # trying to copy files, for example, CONTCAR to POSCAR, as the run # probably did not actually run to begin with. backup(self.archivelist) actions.append("Archived files %s" % self.archivelist) for fname in self.archivelist: if os.path.isfile("%s/%s" % (self.keywords['name'],fname)): os.remove("%s/%s" % (self.keywords['name'],fname)) return {"errors": ["MAST insufficient virtual memory error"], "actions": actions}
def correct(self): actions = list() multiplier = 4 if 'mast_nodes' in self.keywords['program_keys'].keys(): currnodes = self.keywords['program_keys']['mast_nodes'] newnodes = int(currnodes) * multiplier self.keywords['program_keys']['mast_nodes'] = newnodes actions.append("Multiplied mast_nodes by %i to get %i" % (multiplier, newnodes)) if 'mast_processors' in self.keywords['program_keys'].keys(): currprocs = self.keywords['program_keys']['mast_processors'] newprocs = int(currprocs) * multiplier self.keywords['program_keys']['mast_processors'] = newprocs actions.append("Multiplied mast_processors by %i to get %i" % (multiplier, newprocs)) script_commands.write_submit_script(self.keywords) actions.append("Wrote new submission script.") #archive old files. But, for insufficient virtual memory, not worth # trying to copy files, for example, CONTCAR to POSCAR, as the run # probably did not actually run to begin with. backup(self.archivelist) actions.append("Archived files %s" % self.archivelist) for fname in self.archivelist: if os.path.isfile("%s/%s" % (self.keywords['name'], fname)): os.remove("%s/%s" % (self.keywords['name'], fname)) return { "errors": ["MAST insufficient virtual memory error"], "actions": actions }
def correct(self): actions=list() backup(self.archivelist) actions.append("Archived files %s" % self.archivelist) for file in self.archivelist: if (not file in self.copyfromlist) and (not file in self.copytolist): #if it is a copy-from, don't want to delete it, and if it is a copy-to, it will be either overwritted by a copy-from file, or preserved if os.path.isfile(file): os.remove(file) for file in self.copyfromlist: cindex = self.copyfromlist.index(file) if os.path.isfile(file): if os.stat(file).st_size > 0: os.rename(file, self.copytolist[cindex]) actions.append("Copied file %s to %s" % (self.copyfromlist[cindex], self.copytolist[cindex])) else: actions.append("Skipped file copy of %s to %s because %s was empty." % (self.copyfromlist[cindex],self.copytolist[cindex],self.copyfromlist[cindex])) else: actions.append("Skipped file copy of %s to %s because %s did not exist." % (self.copyfromlist[cindex],self.copytolist[cindex],self.copyfromlist[cindex])) return {"errors": ["MAST exceeded walltime error"], "actions": actions}