use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class CreateLaunchExperiment method createEchoExperimentForFSD.
public static String createEchoExperimentForFSD(Airavata.Client client) throws TException {
try {
List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), echoAppId);
for (InputDataObjectType inputDataObjectType : exInputs) {
if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo")) {
inputDataObjectType.setValue("Hello World");
} else if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo2")) {
inputDataObjectType.setValue("http://www.textfiles.com/100/ad.txt");
} else if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo3")) {
inputDataObjectType.setValue("file:///tmp/test.txt");
}
}
List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "echoExperiment", "SimpleEcho2", echoAppId, exInputs);
simpleExperiment.setExperimentOutputs(exOut);
Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), echoAppId);
if (computeResources != null && computeResources.size() != 0) {
for (String id : computeResources.keySet()) {
String resourceName = computeResources.get(id);
if (resourceName.equals(unicoreHostName)) {
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 30, 1048576);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
userConfigurationData.setGenerateCert(false);
userConfigurationData.setUserDN("");
simpleExperiment.setUserConfigurationData(userConfigurationData);
return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
}
}
}
} catch (AiravataSystemException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataSystemException(e);
} catch (InvalidRequestException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new InvalidRequestException(e);
} catch (AiravataClientException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataClientException(e);
} catch (TException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new TException(e);
}
return null;
}
use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class CreateLaunchExperiment method createExperimentNWCHEMStampede.
public static String createExperimentNWCHEMStampede(Airavata.Client client) throws TException {
try {
List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), nwchemAppId);
setNWCHEMInputs(exInputs);
List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), nwchemAppId);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "NWchemExperiment", "Testing", nwchemAppId, exInputs);
simpleExperiment.setExperimentOutputs(exOut);
Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), nwchemAppId);
if (computeResources != null && computeResources.size() != 0) {
for (String id : computeResources.keySet()) {
String resourceName = computeResources.get(id);
if (resourceName.equals(stampedeHostName)) {
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 16, 1, "development", 30, 1);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
}
}
}
} catch (AiravataSystemException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataSystemException(e);
} catch (InvalidRequestException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new InvalidRequestException(e);
} catch (AiravataClientException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataClientException(e);
} catch (TException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new TException(e);
}
return null;
}
use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class ExperimentModelUtil method cloneProcessFromExperiment.
public static ProcessModel cloneProcessFromExperiment(ExperimentModel experiment) {
ProcessModel processModel = new ProcessModel();
processModel.setCreationTime(experiment.getCreationTime());
processModel.setExperimentId(experiment.getExperimentId());
processModel.setApplicationInterfaceId(experiment.getExecutionId());
processModel.setEnableEmailNotification(experiment.isEnableEmailNotification());
List<String> emailAddresses = experiment.getEmailAddresses();
if (emailAddresses != null && !emailAddresses.isEmpty()) {
processModel.setEmailAddresses(emailAddresses);
}
List<InputDataObjectType> experimentInputs = experiment.getExperimentInputs();
if (experimentInputs != null) {
processModel.setProcessInputs(experimentInputs);
}
List<OutputDataObjectType> experimentOutputs = experiment.getExperimentOutputs();
if (experimentOutputs != null) {
processModel.setProcessOutputs(experimentOutputs);
}
UserConfigurationDataModel configData = experiment.getUserConfigurationData();
if (configData != null) {
processModel.setStorageResourceId(configData.getStorageId());
processModel.setExperimentDataDir(configData.getExperimentDataDir());
processModel.setGenerateCert(configData.isGenerateCert());
processModel.setUserDn(configData.getUserDN());
ComputationalResourceSchedulingModel scheduling = configData.getComputationalResourceScheduling();
if (scheduling != null) {
processModel.setProcessResourceSchedule(scheduling);
processModel.setComputeResourceId(scheduling.getResourceHostId());
}
processModel.setUseUserCRPref(configData.isUseUserCRPref());
}
processModel.setUserName(experiment.getUserName());
return processModel;
}
Aggregations