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)