use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class GFacUtils method saveExperimentOutput.
public static void saveExperimentOutput(ProcessContext processContext, String outputName, String outputVal) throws GFacException {
try {
ExperimentCatalog experimentCatalog = processContext.getExperimentCatalog();
String experimentId = processContext.getExperimentId();
ExperimentModel experiment = (ExperimentModel) experimentCatalog.get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
if (experimentOutputs != null && !experimentOutputs.isEmpty()) {
for (OutputDataObjectType expOutput : experimentOutputs) {
if (expOutput.getName().equals(outputName)) {
DataProductModel dataProductModel = new DataProductModel();
dataProductModel.setGatewayId(processContext.getGatewayId());
dataProductModel.setOwnerName(processContext.getProcessModel().getUserName());
dataProductModel.setProductName(outputName);
dataProductModel.setDataProductType(DataProductType.FILE);
DataReplicaLocationModel replicaLocationModel = new DataReplicaLocationModel();
replicaLocationModel.setStorageResourceId(processContext.getStorageResource().getStorageResourceId());
replicaLocationModel.setReplicaName(outputName + " gateway data store copy");
replicaLocationModel.setReplicaLocationCategory(ReplicaLocationCategory.GATEWAY_DATA_STORE);
replicaLocationModel.setReplicaPersistentType(ReplicaPersistentType.TRANSIENT);
replicaLocationModel.setFilePath(outputVal);
dataProductModel.addToReplicaLocations(replicaLocationModel);
ReplicaCatalog replicaCatalog = RegistryFactory.getReplicaCatalog();
String productUri = replicaCatalog.registerDataProduct(dataProductModel);
expOutput.setValue(productUri);
}
}
}
experimentCatalog.update(ExperimentCatalogModelType.EXPERIMENT, experiment, experimentId);
} catch (RegistryException e) {
String msg = "expId: " + processContext.getExperimentId() + " processId: " + processContext.getProcessId() + " : - Error while updating experiment outputs";
throw new GFacException(msg, e);
}
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class AppInterfaceTest method createAppOutput.
public OutputDataObjectType createAppOutput(String inputName, String value, DataType type) {
OutputDataObjectType outputDataObjectType = new OutputDataObjectType();
outputDataObjectType.setName(inputName);
outputDataObjectType.setValue(value);
outputDataObjectType.setType(type);
return outputDataObjectType;
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class SimpleEchoIT method testSimpleLocalhostEchoService.
@Test
public void testSimpleLocalhostEchoService() throws Exception {
log.info("Running job in localhost");
log.info("========================");
log.info("Adding applications...");
DocumentCreatorNew documentCreatorNew = new DocumentCreatorNew(getClient());
String hostAndappId = documentCreatorNew.createLocalHostDocs();
String appId = hostAndappId.split(",")[1];
String hostId = hostAndappId.split(",")[0];
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);
Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
String projectId = getClient().createProject(authzToken, "php_reference_gateway", project);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment("php_reference_gateway", projectId, "admin", "echoExperiment", appId, appId, exInputs);
simpleExperiment.setExperimentOutputs(exOut);
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 1, 1, 1, "normal", 1, 0);
scheduling.setResourceHostId(hostId);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
log.info("Creating experiment...");
final String expId = createExperiment(simpleExperiment);
log.info("Experiment Id returned : " + expId);
launchExperiment(expId);
log.info("Experiment launched successfully\n");
log.info("Monitoring job in localhost");
log.info("===========================");
monitorJob(expId);
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class BaseCaseIT method testEchoService.
// @Test(groups = {"setupTests"}, dependsOnMethods = {"testSetup"})
// public void testURLs() throws AiravataAPIInvocationException {
// URI eventingServiceURL = this.airavataAPI.getAiravataManager().getEventingServiceURL();
// Assert.assertNotNull(eventingServiceURL);
//
// URI messageBoxServiceURL = this.airavataAPI.getAiravataManager().getMessageBoxServiceURL();
// Assert.assertNotNull(messageBoxServiceURL);
// }
@Test(groups = { "echoGroup" }, dependsOnGroups = { "setupTests" })
public void testEchoService() throws Exception {
log.info("Running job in trestles...");
DocumentCreatorNew documentCreator = new DocumentCreatorNew(client);
documentCreator.createPBSDocsForOGCE_Echo();
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);
Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
String projectId = getClient().createProject(authzToken, "default", project);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(gatewayName, projectId, "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 userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
final String expId = createExperiment(simpleExperiment);
System.out.println("Experiment Id returned : " + expId);
log.info("Experiment Id returned : " + expId);
launchExperiment(expId);
System.out.println("Launched successfully");
Thread monitor = (new Thread() {
public void run() {
Map<String, JobStatus> jobStatuses = null;
while (true) {
try {
jobStatuses = client.getJobStatuses(authzToken, expId);
Set<String> strings = jobStatuses.keySet();
for (String key : strings) {
JobStatus jobStatus = jobStatuses.get(key);
if (jobStatus == null) {
return;
} else {
if (JobState.COMPLETE.equals(jobStatus.getJobState())) {
log.info("Job completed Job ID: " + key);
return;
} else {
log.info("Job ID:" + key + " Job Status : " + jobStatuses.get(key).getJobState().toString());
}
}
}
Thread.sleep(5000);
} catch (Exception e) {
log.error("Thread interrupted", e.getMessage());
}
}
}
});
monitor.start();
try {
monitor.join();
} catch (InterruptedException e) {
log.error("Thread interrupted..", e.getMessage());
}
}
use of org.apache.airavata.model.application.io.OutputDataObjectType in project airavata by apache.
the class BaseCaseIT method testEchoServiceStampede.
@Test(groups = { "echoGroup" }, dependsOnGroups = { "setupTests" })
public void testEchoServiceStampede() throws Exception {
log.info("Running job in Stampede...");
DocumentCreatorNew documentCreator = new DocumentCreatorNew(client);
documentCreator.createSlurmDocs();
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);
Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
String projectId = getClient().createProject(authzToken, "default", project);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(gatewayName, projectId, "admin", "echoExperiment", "SimpleEcho3", "SimpleEcho3", exInputs);
simpleExperiment.setExperimentOutputs(exOut);
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org", 1, 1, 1, "normal", 0, 0);
scheduling.setResourceHostId("stampede-host");
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
final String expId = createExperiment(simpleExperiment);
System.out.println("Experiment Id returned : " + expId);
log.info("Experiment Id returned : " + expId);
launchExperiment(expId);
System.out.println("Launched successfully");
Thread monitor = (new Thread() {
public void run() {
Map<String, JobStatus> jobStatuses = null;
while (true) {
try {
jobStatuses = client.getJobStatuses(authzToken, expId);
Set<String> strings = jobStatuses.keySet();
for (String key : strings) {
JobStatus jobStatus = jobStatuses.get(key);
if (jobStatus == null) {
return;
} else {
if (JobState.COMPLETE.equals(jobStatus.getJobState())) {
log.info("Job completed Job ID: " + key);
return;
} else {
log.info("Job ID:" + key + " Job Status : " + jobStatuses.get(key).getJobState().toString());
}
}
}
Thread.sleep(5000);
} catch (Exception e) {
log.error("Thread interrupted", e.getMessage());
}
}
}
});
monitor.start();
try {
monitor.join();
} catch (InterruptedException e) {
log.error("Thread interrupted..", e.getMessage());
}
}
Aggregations