use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class AppInterfaceUtil method createApplicationOutput.
public static OutputDataObjectType createApplicationOutput(String name, String value, DataType type) {
OutputDataObjectType appOutput = new OutputDataObjectType();
appOutput.setName(name);
appOutput.setValue(value);
appOutput.setType(type);
return appOutput;
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class SimpleOrchestratorImpl method createAndSaveOutputDataStagingTasks.
public List<String> createAndSaveOutputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException, AiravataException {
List<String> dataStagingTaskIds = new ArrayList<>();
List<OutputDataObjectType> processOutputs = processModel.getProcessOutputs();
String appName = OrchestratorUtils.getApplicationInterfaceName(orchestratorContext, processModel);
if (processOutputs != null) {
for (OutputDataObjectType processOutput : processOutputs) {
DataType type = processOutput.getType();
switch(type) {
case STDOUT:
if (null == processOutput.getValue() || processOutput.getValue().trim().isEmpty()) {
processOutput.setValue(appName + ".stdout");
}
createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
break;
case STDERR:
if (null == processOutput.getValue() || processOutput.getValue().trim().isEmpty()) {
processOutput.setValue(appName + ".stderr");
}
createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
break;
case URI:
createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
break;
default:
// nothing to do
break;
}
}
}
try {
if (isArchive(processModel, gatewayId)) {
createArchiveDataStatgingTask(processModel, gatewayId, dataStagingTaskIds);
}
} catch (AppCatalogException e) {
throw new RegistryException("Error! Application interface retrieval failed");
}
return dataStagingTaskIds;
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class OrchestratorClientSample method storeExperimentDetail.
/*
public static void main(String[] args) {
try {
AiravataUtils.setExecutionAsClient();
sysUser = ClientSettings.getSetting(DEFAULT_USER);
sysUserPwd = ClientSettings.getSetting(DEFAULT_USER_PASSWORD);
gateway = ClientSettings.getSetting(DEFAULT_GATEWAY);
orchestratorClient = OrchestratorClientFactory.createOrchestratorClient("localhost", 8940);
registry = RegistryFactory.getRegistry(gateway, sysUser, sysUserPwd);
documentCreator = new DocumentCreator(getAiravataAPI());
documentCreator.createLocalHostDocs();
documentCreator.createGramDocs();
documentCreator.createPBSDocsForOGCE();
storeExperimentDetail();
} catch (ApplicationSettingsException e) {
e.printStackTrace();
} catch (RegistryException e) {
e.printStackTrace();
}
}
private static AiravataAPI getAiravataAPI() {
AiravataAPI airavataAPI = null;
try {
airavataAPI = AiravataAPIFactory.getAPI(gateway, sysUser);
} catch (AiravataAPIInvocationException e) {
e.printStackTrace();
}
return airavataAPI;
}
*/
public static void storeExperimentDetail() {
for (int i = 0; i < NUM_CONCURRENT_REQUESTS; i++) {
Thread thread = new Thread() {
public void run() {
List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
InputDataObjectType input = new InputDataObjectType();
input.setName("echo_input");
input.setType(DataType.STRING);
input.setValue("echo_output=Hello World");
exInputs.add(input);
List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
OutputDataObjectType output = new OutputDataObjectType();
output.setName("echo_output");
output.setType(DataType.STRING);
output.setValue("");
exOut.add(output);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs);
simpleExperiment.setExperimentOutputs(exOut);
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0);
scheduling.setResourceHostId("gsissh-trestles");
UserConfigurationDataModel userConfigurationDataModel = new UserConfigurationDataModel();
userConfigurationDataModel.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationDataModel);
String expId = null;
try {
// expId = (String) registry.add(ParentDataType.EXPERIMENT, simpleExperiment);
} catch (Exception e) {
e.printStackTrace();
}
try {
orchestratorClient.launchExperiment(expId, "airavataToken");
} catch (TException e) {
e.printStackTrace();
}
}
};
thread.start();
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class OutputNodeImpl method convert.
private OutputDataObjectType convert(InputDataObjectType inputObject) {
if (inputObject != null) {
OutputDataObjectType output = new OutputDataObjectType(getName());
output.setValue(inputObject.getValue());
output.setType(inputObject.getType());
return output;
}
return null;
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class DataTransferrer method downloadStdOuts.
public void downloadStdOuts() throws GFacException {
String stdoutFileName = new File(stdoutLocation).getName();
String stderrFileName = new File(stderrLocation).getName();
FileDownloader f1 = null;
log.info("Downloading stdout and stderr..");
log.info(stdoutFileName + " -> " + stdoutLocation);
f1 = new FileDownloader(stdoutFileName, stdoutLocation, Mode.overwrite);
try {
f1.perform(storageClient);
// String stdoutput = readFile(stdoutLocation);
} catch (Exception e) {
log.error("Error while downloading " + stdoutFileName + " to location " + stdoutLocation, e);
}
log.info(stderrFileName + " -> " + stderrLocation);
f1.setFrom(stderrFileName);
f1.setTo(stderrLocation);
try {
f1.perform(storageClient);
// String stderror = readFile(stderrLocation);
} catch (Exception e) {
log.error("Error while downloading " + stderrFileName + " to location " + stderrLocation);
}
String scriptExitCodeFName = "UNICORE_SCRIPT_EXIT_CODE";
String scriptCodeLocation = gatewayDownloadLocation + File.separator + scriptExitCodeFName;
if (UASDataStagingProcessor.isUnicoreEndpoint(processContext)) {
f1.setFrom(scriptExitCodeFName);
f1.setTo(scriptCodeLocation);
try {
f1.perform(storageClient);
OutputDataObjectType output = new OutputDataObjectType();
output.setName(scriptExitCodeFName);
output.setValue(scriptCodeLocation);
output.setType(DataType.URI);
output.setIsRequired(true);
processContext.getProcessModel().getProcessOutputs().add(output);
log.info("UNICORE_SCRIPT_EXIT_CODE -> " + scriptCodeLocation);
log.info("EXIT CODE: " + readFile(scriptCodeLocation));
} catch (Exception e) {
log.error("Error downloading file " + scriptExitCodeFName + " to location " + scriptCodeLocation, e);
}
}
}
Aggregations