def main(): # An RUR output plugin that will write data specific to a PBS job # to a well known path that PBS hooks can access. The format of # the file will be: # pluginName : apid : pluginOutput # # See the Cray document: "Managing System Software for the Cray # Linux Environment" section 12.7 "RUR Plugins" for more # information on the RUR plugin interface. # http://docs.cray.com/books/S-2393-5101/S-2393-5101.pdf try: rur_output = list() rur_output = rur_output_args(sys.argv[1:], True) apid = rur_output[0] jobid = rur_output[1] inputfilelist = rur_output[4] except Exception as e: rur_errorlog("RUR PBS output plugin rur_output_args error '%s'" % str(e)) exit(1) # If an aprun runs within a PBS job, the jobid will have the PBS # jobid set. It will have the short servername like "77.sdb". # If an aprun is run interactively, the jobid will be "0". if jobid == "0": # not from a PBS job exit(0) try: output = outname(jobid) outfile = open(output, "a") except Exception: rur_errorlog("RUR PBS output plugin cannot access output file %s" % output) exit(1) # copy input to job specific output file for inputfile in inputfilelist: try: plugin = get_plugin_name(inputfile) plugin = plugin.split()[1] # keep just the plugin name with open(inputfile, "r") as infile: for line in infile: outfile.write("%s : %s : %s" % (plugin, apid, line)) except Exception: pass outfile.close()
# If an aprun runs within a PBS job, the jobid will have the PBS # jobid set. It will have the short servername like "77.sdb". # If an aprun is run interactively, the jobid will be "0". if jobid == "0": # not from a PBS job exit(0) try: output = outname(jobid) outfile = open(output, "a") except Exception: rur_errorlog("RUR PBS output plugin cannot access output file %s" % output) exit(1) # copy input to job specific output file for inputfile in inputfilelist: try: plugin = get_plugin_name(inputfile) plugin = plugin.split()[1] # keep just the plugin name with open(inputfile, "r") as infile: for line in infile: outfile.write("%s : %s : %s" % (plugin, apid, line)) except Exception: pass outfile.close() if __name__ == "__main__": main()