use of org.apache.airavata.model.messaging.event.ProcessTerminateEvent 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