use of org.apache.airavata.orchestrator.core.exception.OrchestratorException in project airavata by apache.
the class OrchestratorServerHandler method launchProcess.
@Override
public boolean launchProcess(String processId, String airavataCredStoreToken, String gatewayId) throws TException {
try {
ProcessModel processModel = (ProcessModel) experimentCatalog.get(ExperimentCatalogModelType.PROCESS, processId);
String applicationId = processModel.getApplicationInterfaceId();
if (applicationId == null) {
log.error(processId, "Application interface id shouldn't be null.");
throw new OrchestratorException("Error executing the job, application interface id shouldn't be null.");
}
// set application deployment id to process model
ApplicationDeploymentDescription applicationDeploymentDescription = getAppDeployment(processModel, applicationId);
processModel.setApplicationDeploymentId(applicationDeploymentDescription.getAppDeploymentId());
// set compute resource id to process model, default we set the same in the user preferred compute host id
processModel.setComputeResourceId(processModel.getProcessResourceSchedule().getResourceHostId());
experimentCatalog.update(ExperimentCatalogModelType.PROCESS, processModel, processModel.getProcessId());
return orchestrator.launchProcess(processModel, airavataCredStoreToken);
} catch (Exception e) {
log.error(processId, "Error while launching process ", e);
throw new TException(e);
}
}
use of org.apache.airavata.orchestrator.core.exception.OrchestratorException in project airavata by apache.
the class GFACPassiveJobSubmitter method terminate.
/**
* Submit the experiment the terminate.queue job queue and remove the experiment from shared launch.queue
* @param experimentId
* @param processId
* @return
* @throws OrchestratorException
*/
public boolean terminate(String experimentId, String processId, String tokenId) throws OrchestratorException {
String gatewayId = null;
try {
CredentialReader credentialReader = GFacUtils.getCredentialReader();
if (credentialReader != null) {
try {
gatewayId = credentialReader.getGatewayID(tokenId);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
}
}
if (gatewayId == null || gatewayId.isEmpty()) {
gatewayId = ServerSettings.getDefaultUserGateway();
}
ProcessTerminateEvent processTerminateEvent = new ProcessTerminateEvent(processId, gatewayId, tokenId);
MessageContext messageContext = new MessageContext(processTerminateEvent, MessageType.TERMINATEPROCESS, "LAUNCH.TERMINATE-" + UUID.randomUUID().toString(), gatewayId);
messageContext.setUpdatedTime(AiravataUtils.getCurrentTimestamp());
publisher.publish(messageContext);
return true;
} catch (Exception e) {
throw new OrchestratorException(e);
}
}
Aggregations