use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class OrchestratorUtils method getLoginUserName.
public static String getLoginUserName(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException, AiravataException {
try {
ComputeResourcePreference computeResourcePreference = getComputeResourcePreference(context, gatewayId, processModel.getComputeResourceId());
ComputationalResourceSchedulingModel processResourceSchedule = processModel.getProcessResourceSchedule();
if (processModel.isUseUserCRPref()) {
UsrResourceProfile userResourceProfile = getUserResourceProfile(context);
UserComputeResourcePreference userComputeResourcePreference = userResourceProfile.getUserComputeResourcePreference(processModel.getUserName(), gatewayId, processModel.getComputeResourceId());
if (isValid(userComputeResourcePreference.getLoginUserName())) {
return userComputeResourcePreference.getLoginUserName();
} else if (isValid(processResourceSchedule.getOverrideLoginUserName())) {
logger.warn("User computer resource preference doesn't have valid user login name, using computer " + "resource scheduling login name " + processResourceSchedule.getOverrideLoginUserName());
return processResourceSchedule.getOverrideLoginUserName();
} else if (isValid(computeResourcePreference.getLoginUserName())) {
logger.warn("Either User computer resource preference or computer resource scheduling " + "doesn't have valid user login name, using gateway computer resource preference login name " + computeResourcePreference.getLoginUserName());
return computeResourcePreference.getLoginUserName();
} else {
throw new AiravataException("Login name is not found");
}
} else {
if (isValid(processResourceSchedule.getOverrideLoginUserName())) {
return processResourceSchedule.getOverrideLoginUserName();
} else if (isValid(computeResourcePreference.getLoginUserName())) {
logger.warn("Process compute resource scheduling doesn't have valid user login name, " + "using gateway computer resource preference login name " + computeResourcePreference.getLoginUserName());
return computeResourcePreference.getLoginUserName();
} else {
throw new AiravataException("Login name is not found");
}
}
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog to fetch login username", e);
throw new RegistryException("Error occurred while initializing app catalog to fetch login username", e);
}
}
use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel 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.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class DataRetrievalIT method runExperiment.
public String runExperiment(String user, String project) throws ApplicationSettingsException, AiravataClientException, InvalidRequestException, AiravataClientException, AiravataSystemException, TException, ExperimentNotFoundException {
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", project, user, "echoExperiment", "SimpleEcho0", "SimpleEcho0", exInputs);
simpleExperiment.setExperimentOutputs(exOut);
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("localhost", 1, 1, 1, "normal", 0, 0);
scheduling.setResourceHostId("localhost");
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
Client client = getClient();
final String expId = client.createExperiment(authzToken, "default", simpleExperiment);
client.launchExperiment(authzToken, expId, "testToken");
return expId;
}
use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class OrchestratorUtils method getScratchLocation.
public static String getScratchLocation(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException, AiravataException {
try {
ComputeResourcePreference computeResourcePreference = getComputeResourcePreference(context, gatewayId, processModel.getComputeResourceId());
ComputationalResourceSchedulingModel processResourceSchedule = processModel.getProcessResourceSchedule();
if (processModel.isUseUserCRPref()) {
UsrResourceProfile userResourceProfile = getUserResourceProfile(context);
UserComputeResourcePreference userComputeResourcePreference = userResourceProfile.getUserComputeResourcePreference(processModel.getUserName(), gatewayId, processModel.getComputeResourceId());
if (isValid(userComputeResourcePreference.getScratchLocation())) {
return userComputeResourcePreference.getScratchLocation();
} else if (isValid(processResourceSchedule.getOverrideScratchLocation())) {
logger.warn("User computer resource preference doesn't have valid scratch location, using computer " + "resource scheduling scratch location " + processResourceSchedule.getOverrideScratchLocation());
return processResourceSchedule.getOverrideScratchLocation();
} else if (isValid(computeResourcePreference.getScratchLocation())) {
logger.warn("Either User computer resource preference or computer resource scheduling doesn't have " + "valid scratch location, using gateway computer resource preference scratch location" + computeResourcePreference.getScratchLocation());
return computeResourcePreference.getScratchLocation();
} else {
throw new AiravataException("Scratch location is not found");
}
} else {
if (isValid(processResourceSchedule.getOverrideScratchLocation())) {
return processResourceSchedule.getOverrideScratchLocation();
} else if (isValid(computeResourcePreference.getScratchLocation())) {
logger.warn("Process compute resource scheduling doesn't have valid scratch location, " + "using gateway computer resource preference scratch location" + computeResourcePreference.getScratchLocation());
return computeResourcePreference.getScratchLocation();
} else {
throw new AiravataException("Scratch location is not found");
}
}
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog to fetch scratch location", e);
throw new RegistryException("Error occurred while initializing app catalog to fetch scratch location", e);
}
}
use of org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel in project airavata by apache.
the class BatchQueueValidator method validateUserConfiguration.
private List<ValidatorResult> validateUserConfiguration(ExperimentModel experiment, ProcessModel processModel) throws AppCatalogException {
List<ValidatorResult> validatorResultList = new ArrayList<ValidatorResult>();
try {
UserConfigurationDataModel userConfigurationData = experiment.getUserConfigurationData();
ComputationalResourceSchedulingModel computationalResourceScheduling = userConfigurationData.getComputationalResourceScheduling();
if (userConfigurationData.isAiravataAutoSchedule()) {
logger.info("User enabled Auto-Schedule. Hence we don't do validation..");
ValidatorResult validatorResult = new ValidatorResult();
validatorResult.setResult(true);
validatorResultList.add(validatorResult);
} else {
ComputeResourceDescription computeResource;
if (processModel == null) {
computeResource = appCatalog.getComputeResource().getComputeResource(experiment.getUserConfigurationData().getComputationalResourceScheduling().getResourceHostId());
} else {
computeResource = appCatalog.getComputeResource().getComputeResource(processModel.getProcessResourceSchedule().getResourceHostId());
}
List<BatchQueue> batchQueues = computeResource.getBatchQueues();
if (batchQueues != null && !batchQueues.isEmpty()) {
if (computationalResourceScheduling != null) {
String experimentQueueName = computationalResourceScheduling.getQueueName().trim();
int experimentWallTimeLimit = computationalResourceScheduling.getWallTimeLimit();
int experimentNodeCount = computationalResourceScheduling.getNodeCount();
int experimentCPUCount = computationalResourceScheduling.getTotalCPUCount();
ValidatorResult queueNameResult = new ValidatorResult();
// Set the validation to false. Once all the queue's are looped, if nothing matches, then this gets passed.
queueNameResult.setResult(false);
queueNameResult.setErrorDetails("The specified queue " + experimentQueueName + " does not exist. If you believe this is an error, contact the administrator to verify App-Catalog Configurations");
for (BatchQueue queue : batchQueues) {
String resourceQueueName = queue.getQueueName();
int maxQueueRunTime = queue.getMaxRunTime();
int maxNodeCount = queue.getMaxNodes();
int maxcpuCount = queue.getMaxProcessors();
if (resourceQueueName != null && resourceQueueName.equals(experimentQueueName)) {
queueNameResult.setResult(true);
queueNameResult.setErrorDetails("");
// Validate if the specified wall time is within allowable limit
ValidatorResult wallTimeResult = new ValidatorResult();
if (experimentWallTimeLimit == 0) {
wallTimeResult.setResult(false);
wallTimeResult.setErrorDetails("Walltime cannot be zero for queue " + resourceQueueName);
} else {
if (maxQueueRunTime == 0) {
wallTimeResult.setResult(true);
wallTimeResult.setErrorDetails("Maximum wall time is not configured for the queue," + "Validation is being skipped");
logger.info("Maximum wall time is not configured for the queue" + "Validation is being skipped");
} else {
if (maxQueueRunTime < experimentWallTimeLimit) {
wallTimeResult.setResult(false);
wallTimeResult.setErrorDetails("Job Execution walltime " + experimentWallTimeLimit + "exceeds the allowable walltime" + maxQueueRunTime + "for queue " + resourceQueueName);
} else {
wallTimeResult.setResult(true);
wallTimeResult.setErrorDetails("");
}
}
}
// validate max node count
ValidatorResult nodeCountResult = new ValidatorResult();
if (maxNodeCount == 0) {
nodeCountResult.setResult(true);
nodeCountResult.setErrorDetails("Max node count is not configured for the queue," + "Validation is being skipped");
logger.info("Max node count is not configured for the queue" + "Validation is being skipped");
} else {
if (experimentNodeCount == 0) {
nodeCountResult.setResult(false);
nodeCountResult.setErrorDetails("Job Execution node count cannot be zero for queue " + resourceQueueName);
} else {
if (maxNodeCount < experimentNodeCount) {
nodeCountResult.setResult(false);
nodeCountResult.setErrorDetails("Job Execution node count " + experimentNodeCount + "exceeds the allowable node count" + maxNodeCount + "for queue " + resourceQueueName);
} else {
nodeCountResult.setResult(true);
nodeCountResult.setErrorDetails("");
}
}
}
// validate cpu count
ValidatorResult cpuCountResult = new ValidatorResult();
if (maxcpuCount == 0) {
cpuCountResult.setResult(true);
cpuCountResult.setErrorDetails("Max cpu count is not configured for the queue," + "Validation is being skipped");
logger.info("Max cpu count is not configured for the queue" + "Validation is being skipped");
} else {
if (experimentCPUCount == 0) {
cpuCountResult.setResult(false);
cpuCountResult.setErrorDetails("Job Execution cpu count cannot be zero for queue " + resourceQueueName);
} else {
if (maxcpuCount < experimentCPUCount) {
cpuCountResult.setResult(false);
cpuCountResult.setErrorDetails("Job Execution cpu count " + experimentCPUCount + "exceeds the allowable cpu count" + maxcpuCount + "for queue " + resourceQueueName);
} else {
cpuCountResult.setResult(true);
cpuCountResult.setErrorDetails("");
}
}
}
validatorResultList.add(wallTimeResult);
validatorResultList.add(nodeCountResult);
validatorResultList.add(cpuCountResult);
}
}
validatorResultList.add(queueNameResult);
}
} else {
// for some compute resources, you dnt need to specify queue names
ValidatorResult result = new ValidatorResult();
logger.info("There are not queues defined under the compute resource. Airavata assumes this experiment " + "does not need a queue name...");
result.setResult(true);
validatorResultList.add(result);
}
}
} catch (AppCatalogException e) {
logger.error("Error while getting information from App catalog", e);
throw new AppCatalogException("Error while getting information from App catalog", e);
}
return validatorResultList;
}
Aggregations