protected byte[] stageOut(final StorageClient uspace, final String pFileName) throws ExceptionReport { try { RByteIOClient fileClient = uspace.getExport(pFileName); ByteArrayOutputStream bos = new ByteArrayOutputStream(); fileClient.readAllData(bos); return bos.toByteArray(); } catch (IOException e) { LOGGER.error("Error while fetching remote file '" + pFileName + "'."); throw new ExceptionReport("Error while fetching remote file '" + pFileName + "'.", ExceptionReport.REMOTE_COMPUTATION_ERROR, e); } }
private void submitExecutionScript(StorageClient pSms) throws Exception { LOGGER.info("Submit job execution script."); InputStream source = UnicoreClient.class.getResourceAsStream(JOB_EXECUTION_SCRIPT); RByteIOClient fileClient = pSms.getImport("/" + JOB_EXECUTION_SCRIPT); fileClient.writeAllData(source); }
ImportFileResponseDocument outDoc = smsHome.ImportFile(out); EndpointReferenceType outEpr = outDoc.getImportFileResponse().getImportEPR(); RByteIOClient fileClient = new RByteIOClient(outEpr.getAddress().getStringValue(), outEpr, pSecurityProperties); fileClient.writeAllData(source);
/** * @param pSms * @param pAlgorithmInput * @param tc * @throws Exception */ private void submitInputFiles(StorageClient pSms, DistributedAlgorithmInput pAlgorithmInput) throws Exception { // create compressed input data LOGGER.info("Serialize input data."); byte[] data = CompressUtilities.serialize(pAlgorithmInput); byte[] dataCompressed = CompressUtilities.createCompressedData(data); LOGGER.info("Compress input data (ratio: " + ((double) dataCompressed.length) / ((double) data.length) + ")."); // submit input data LOGGER.info("Submit input data."); RByteIOClient fileClient = pSms.getImport("/" + TARGET_SYSTEM_INPUT_FILE_NAME); fileClient.write(dataCompressed); }
ImportFileResponseDocument outDoc = smsHome.ImportFile(out); EndpointReferenceType outEpr = outDoc.getImportFileResponse().getImportEPR(); RByteIOClient fileClient = new RByteIOClient(outEpr.getAddress().getStringValue(), outEpr, pSecurityProperties); fileClient.writeAllData(source);
protected void submitInputData(StorageClient pSms, UnicoreAlgorithmInput pAlgorithmInput) throws Exception { RByteIOClient fileClient = pSms.getImport("/" + TARGET_SYSTEM_INPUT_FILE_NAME); // create serialized input data LOGGER.info("Serialize input data."); byte[] data = Compression.toByteArray(pAlgorithmInput); // create input data Properties unicoreProperties = UnicoreAlgorithmRepository.getInstance().getUnicoreProperties(); byte[] dataCompressed = null; if (Boolean.parseBoolean(unicoreProperties.getProperty(UnicoreAlgorithmRepository.CFG_COMPRESSION))) { dataCompressed = Compression.createCompressedData(data, Boolean.parseBoolean(unicoreProperties .getProperty(UnicoreAlgorithmRepository.CFG_COMPRESSION))); LOGGER.info("Compress input data (ratio: " + ((double) dataCompressed.length) / ((double) data.length) + ")."); } // submit input data if (Boolean.parseBoolean(unicoreProperties.getProperty(UnicoreAlgorithmRepository.CFG_COMPRESSION))) { LOGGER.info("Submit compressed input data."); fileClient.write(dataCompressed); } else { LOGGER.info("Submit input data."); fileClient.write(data); } }
/** * @param pSms * @param tc * @throws Exception */ private void submitExecutionScript(StorageClient pSms) throws Exception { LOGGER.info("Submit job execution script."); InputStream source = Unicore6Client.class.getResourceAsStream(JOB_EXECUTION_SCRIPT); RByteIOClient fileClient = pSms.getImport("/" + JOB_EXECUTION_SCRIPT); fileClient.writeAllData(source); }
/** * @param uspace * @param pFileName * @return * @throws IOException * @throws Exception */ protected byte[] stageOut(final StorageClient uspace, final String pFileName) throws ExceptionReport { try { RByteIOClient fileClient = uspace.getExport(pFileName); ByteArrayOutputStream bos = new ByteArrayOutputStream(); fileClient.readAllData(bos); return bos.toByteArray(); } catch (IOException e) { LOGGER.error("Error while fetching remote file '" + pFileName + "'."); throw new ExceptionReport("Error while fetching remote file '" + pFileName + "'.", ExceptionReport.REMOTE_COMPUTATION_ERROR, e); } } }
protected void submitWpsConfiguration(StorageClient pSms) throws Exception { RByteIOClient fileClient = pSms.getImport("/wps_config.xml"); File f = new File(WPSConfig.getConfigPath()); FileInputStream is = new FileInputStream(f); fileClient.writeAllData(is); is.close(); } }