# Query job status status = appServicePort.queryStatus(queryStatusRequest(jobID)) # If execution is successful retrieve job outputs. if status._code == 8: # 8 = GramJob.STATUS_DONE # Create local directory to hold output files output_dir = 'meme_out' mkdir(output_dir); # Instantiate a collection of outputs outputs = appServicePort.getOutputs(getOutputsRequest(jobID)) # Instantiate a request object for retrieving output files fileRequest = getOutputAsBase64ByNameRequest() # Retreive each output file and save to local directory. # MEME writes stdout and stderr to files that aren't listed # in the response, so we handle those separately. print "\tStandard Output:", outputs._stdOut localOutput = open(output_dir + '/' + "stdout.txt", "w") fileRequest._jobID = jobID fileRequest._fileName = "stdout.txt" content = appServicePort.getOutputAsBase64ByName(fileRequest) print >>localOutput, content localOutput.close() print "\tStandard Error:", outputs._stdErr localOutput = open(output_dir + '/' + "stderr.txt", "w") fileRequest._jobID = jobID fileRequest._fileName = "stderr.txt"
sleep(30) # Query job status status = appServicePort.queryStatus(queryStatusRequest(jobID)) if status._code == 8: # 8 = GramJob.STATUS_DONE # Create local directory to hold output files output_dir = 'fimo_out' mkdir(output_dir) # Find out what outputs were generated by the job outputs = appServicePort.getOutputs(getOutputsRequest(jobID)) # Instantiate a request object for reteiving output files req = getOutputAsBase64ByNameRequest() # Retreive each output file and save to local directory. # MEME writes stdout and stderr to files that aren't listed # in the response, so we handle those separately. print "\tStandard Output:", outputs._stdOut output = open(output_dir + '/' + "stdout.txt", "w") req._jobID = resp._jobID req._fileName = "stdout.txt" content = appServicePort.getOutputAsBase64ByName(req) print >> output, content output.close() print "\tStandard Error:", outputs._stdErr output = open(output_dir + '/' + "stderr.txt", "w") req._jobID = jobID req._fileName = "stderr.txt"
# Query job status status = appServicePort.queryStatus(queryStatusRequest(jobID)) # If execution is successful retrieve job outputs. if status._code == 8: # 8 = GramJob.STATUS_DONE # Create local directory to hold output files output_dir = "meme_out" mkdir(output_dir) # Instantiate a collection of outputs outputs = appServicePort.getOutputs(getOutputsRequest(jobID)) # Instantiate a request object for retrieving output files fileRequest = getOutputAsBase64ByNameRequest() # Retreive each output file and save to local directory. # MEME writes stdout and stderr to files that aren't listed # in the response, so we handle those separately. print "\tStandard Output:", outputs._stdOut localOutput = open(output_dir + "/" + "stdout.txt", "w") fileRequest._jobID = jobID fileRequest._fileName = "stdout.txt" content = appServicePort.getOutputAsBase64ByName(fileRequest) print >> localOutput, content localOutput.close() print "\tStandard Error:", outputs._stdErr localOutput = open(output_dir + "/" + "stderr.txt", "w") fileRequest._jobID = jobID fileRequest._fileName = "stderr.txt"
# Retrieve job outputs, if execution is successful if status._code == 8: # 8 = GramJob.STATUS_DONE print "Retrieving Babel output metadata: " resp = appServicePort.getOutputs(getOutputsRequest(jobID)) # Retrieve a listing of all output files print "\tStandard Output:", resp._stdOut, "\n", \ "\tStandard Error:", resp._stdErr if (resp._outputFile != None): for i in range(0, resp._outputFile.__len__()): print "\t" + resp._outputFile[i]._name, ":", resp._outputFile[i]._url # Retrieve an output file as a Base64 encoded binary print "Downloading Babel output: " req = getOutputAsBase64ByNameRequest() req._jobID = jobID req._fileName = "stdout.txt" resp = appServicePort.getOutputAsBase64ByName(req) print resp # Set up blocking job launch req = launchJobBlockingRequest() req._argList = "-ipdb benzene.pdb -h -opdb output.pdb" inputFiles = [] inputFile = ns0.InputFileType_Def('inputFile') inputFile._name = 'benzene.pdb' sampleFile = open("./etc/benzene.pdb", "r") sampleFileString = sampleFile.read() sampleFile.close() inputFile._contents = sampleFileString