def finalizeCodeOutput(self, command, output, workingDir): """ This method is called by the RAVEN code at the end of each run (if the method is present, since it is optional). It can be used for those codes, that do not create CSV files to convert the whatever output format into a csv @ In, command, string, the command used to run the just ended job @ In, output, string, the Output name root @ In, workingDir, string, current working dir @ Out, response, dict, dictionary containing the data """ outputobj = relapdata.relapdata( os.path.join(workingDir, output + '.o'), self.outputDeck) if outputobj.hasAtLeastMinorData(): response = outputobj.returnData() if self.det: prefix = workingDir.split(os.path.sep)[-1] # check end time endTime = response['time'][-1] endTimeStep = len(response['time']) #check the variable that caused the trip (if any) tripVariable = None foundTrip = False for var in self.detVars: if foundTrip: break splitted = var.split(":") tripName = splitted[len(splitted) - 2].strip() for deckNum in self.tripControlVariables[prefix]: tripSplit = tripName.split("|") if len(tripSplit) > 1: tripDeck, tripName = int( tripSplit[0]), tripSplit[-1] else: tripDeck, tripName = 1, tripSplit[-1] if tripDeck == deckNum and tripName in self.tripControlVariables[ prefix][deckNum].values(): for cntrVar, trip in self.tripControlVariables[ prefix][deckNum].items(): if response["cntrlvar_" + cntrVar][-1] != response[ "cntrlvar_" + cntrVar][-2]: # the trip went off if trip in var: tripVariable = var foundTrip = True break if tripVariable is not None: filename = os.path.join(workingDir, output + "_actual_branch_info.xml") self._writeBranchInfo(filename, endTime, endTimeStep, tripVariable) return response else: raise IOError( 'Relap5 output file ' + command.split('-o')[0].split('-i')[-1].strip() + '.o' + ' does not contain any minor edits. It might be crashed!')
def finalizeCodeOutput(self,command,output,workingDir): """ This method is called by the RAVEN code at the end of each run (if the method is present, since it is optional). It can be used for those codes, that do not create CSV files to convert the whatever output format into a csv @ In, command, string, the command used to run the just ended job @ In, output, string, the Output name root @ In, workingDir, string, current working dir @ Out, output, string, optional, present in case the root of the output file gets changed in this method. """ outfile = os.path.join(workingDir,output+'.o') outputobj=relapdata.relapdata(outfile,self.outputDeck) if outputobj.hasAtLeastMinorData(): outputobj.writeCSV(os.path.join(workingDir,output+'.csv')) else: raise IOError('Relap5 output file '+ command.split('-o')[0].split('-i')[-1].strip()+'.o' + ' does not contain any minor edits. It might be crashed!')