def displayResults(jobID): """ Displays URLs of resulting files, if they are not to be fetched automatically. """ global service_url appServicePort = AppServiceLocator().getAppServicePort(service_url) resp = appServicePort.getOutputs(getOutputsRequest(jobID)) # Retrieve a listing of all output files stdout.write("\tStandard Output: %s\n" % resp._stdOut, "\n") stdout.write("\tStandard Error: %s\n", resp._stdErr) if (resp._outputFile != None): for i in range(0, resp._outputFile.__len__()): stdout.write("\t%s: %s\n" % (resp._outputFile[i]._name, resp._outputFile[i]._url)) stdout.write("\tStandard Error: %s\n" % resp._stdErr)
def pollStatus(jobID,outputDirectory): """ Determines current status of run and executes fetching of results if the run is completed. """ global service_url appServicePort = AppServiceLocator().getAppServicePort(service_url) status = appServicePort.queryStatus(queryStatusRequest(jobID)) if status._code == 4: stderr.write("Error! The calculation failed!\n") stderr.write("Message: %s\n" % status._message) sys.exit(13) elif status._code != 8: stderr.write("Sorry, the calculation hasn't been completed yet. Please wait a short while and attempt to fetch the files again.\n") sys.exit(13) else: resp = appServicePort.getOutputs(getOutputsRequest(jobID)) fetchResults(jobID, outputDirectory, resp._outputFile, status._code==4)
def pollStatus(jobID, outputDirectory): """ Determines current status of run and executes fetching of results if the run is completed. """ global service_url appServicePort = AppServiceLocator().getAppServicePort(service_url) status = appServicePort.queryStatus(queryStatusRequest(jobID)) if status._code == 4: stderr.write("Error! The calculation failed!\n") stderr.write("Message: %s\n" % status._message) sys.exit(13) elif status._code != 8: stderr.write( "Sorry, the calculation hasn't been completed yet. Please wait a short while and attempt to fetch the files again.\n" ) sys.exit(13) else: resp = appServicePort.getOutputs(getOutputsRequest(jobID)) fetchResults(jobID, outputDirectory, resp._outputFile, status._code == 4)