Search in sources :

Example 1 with JobIdentifier

use of org.apache.airavata.model.messaging.event.JobIdentifier in project airavata by apache.

the class MessagingFactory method statusRoutingkey.

private static String statusRoutingkey(MessageContext msgCtx) {
    String gatewayId = msgCtx.getGatewayId();
    String routingKey = null;
    if (msgCtx.getType() == MessageType.EXPERIMENT) {
        ExperimentStatusChangeEvent event = (ExperimentStatusChangeEvent) msgCtx.getEvent();
        routingKey = gatewayId + "." + event.getExperimentId();
    } else if (msgCtx.getType() == MessageType.TASK) {
        TaskStatusChangeEvent event = (TaskStatusChangeEvent) msgCtx.getEvent();
        routingKey = gatewayId + "." + event.getTaskIdentity().getExperimentId() + "." + event.getTaskIdentity().getProcessId() + "." + event.getTaskIdentity().getTaskId();
    } else if (msgCtx.getType() == MessageType.PROCESSOUTPUT) {
        TaskOutputChangeEvent event = (TaskOutputChangeEvent) msgCtx.getEvent();
        routingKey = gatewayId + "." + event.getTaskIdentity().getExperimentId() + "." + event.getTaskIdentity().getProcessId() + "." + event.getTaskIdentity().getTaskId();
    } else if (msgCtx.getType() == MessageType.PROCESS) {
        ProcessStatusChangeEvent event = (ProcessStatusChangeEvent) msgCtx.getEvent();
        ProcessIdentifier processIdentifier = event.getProcessIdentity();
        routingKey = gatewayId + "." + processIdentifier.getExperimentId() + "." + processIdentifier.getProcessId();
    } else if (msgCtx.getType() == MessageType.JOB) {
        JobStatusChangeEvent event = (JobStatusChangeEvent) msgCtx.getEvent();
        JobIdentifier identity = event.getJobIdentity();
        routingKey = gatewayId + "." + identity.getExperimentId() + "." + identity.getProcessId() + "." + identity.getTaskId() + "." + identity.getJobId();
    }
    return routingKey;
}
Also used : TaskStatusChangeEvent(org.apache.airavata.model.messaging.event.TaskStatusChangeEvent) TaskOutputChangeEvent(org.apache.airavata.model.messaging.event.TaskOutputChangeEvent) ExperimentStatusChangeEvent(org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent) JobStatusChangeEvent(org.apache.airavata.model.messaging.event.JobStatusChangeEvent) ProcessStatusChangeEvent(org.apache.airavata.model.messaging.event.ProcessStatusChangeEvent) JobIdentifier(org.apache.airavata.model.messaging.event.JobIdentifier) ProcessIdentifier(org.apache.airavata.model.messaging.event.ProcessIdentifier)

Example 2 with JobIdentifier

use of org.apache.airavata.model.messaging.event.JobIdentifier in project airavata by apache.

the class EventData method process.

private void process(MessageContext event) {
    this.messageId = event.getMessageId();
    if (event.getType() == MessageType.EXPERIMENT) {
        ExperimentStatusChangeEvent experimentStatusChangeEvent = (ExperimentStatusChangeEvent) event.getEvent();
        this.status = experimentStatusChangeEvent.getState().toString();
        this.experimentId = experimentStatusChangeEvent.getExperimentId();
        this.workflowNodeId = "";
        this.message = "Received experiment event , expId : " + experimentStatusChangeEvent.getExperimentId() + ", status : " + experimentStatusChangeEvent.getState().toString();
    } else if (event.getType() == MessageType.WORKFLOWNODE) {
        WorkflowNodeStatusChangeEvent wfnStatusChangeEvent = (WorkflowNodeStatusChangeEvent) event.getEvent();
        WorkflowIdentifier wfIdentifier = wfnStatusChangeEvent.getWorkflowNodeIdentity();
        this.status = wfnStatusChangeEvent.getState().toString();
        this.experimentId = wfIdentifier.getExperimentId();
        this.workflowNodeId = wfIdentifier.getWorkflowNodeId();
        this.message = "Received workflow status change event, expId : " + wfIdentifier.getExperimentId() + ", nodeId : " + wfIdentifier.getWorkflowNodeId() + " , status : " + wfnStatusChangeEvent.getState().toString();
    } else if (event.getType() == MessageType.TASK) {
        TaskStatusChangeEvent taskStatusChangeEvent = (TaskStatusChangeEvent) event.getEvent();
        TaskIdentifier taskIdentifier = taskStatusChangeEvent.getTaskIdentity();
        this.status = taskStatusChangeEvent.getState().toString();
        this.experimentId = taskIdentifier.getExperimentId();
        this.workflowNodeId = taskIdentifier.getWorkflowNodeId();
        this.message = "Received task event , expId : " + taskIdentifier.getExperimentId() + ",taskId : " + taskIdentifier.getTaskId() + ", wfNodeId : " + taskIdentifier.getWorkflowNodeId() + ", status : " + taskStatusChangeEvent.getState().toString();
    } else if (event.getType() == MessageType.JOB) {
        JobStatusChangeEvent jobStatusChangeEvent = (JobStatusChangeEvent) event.getEvent();
        JobIdentifier jobIdentifier = jobStatusChangeEvent.getJobIdentity();
        this.status = jobStatusChangeEvent.getState().toString();
        this.experimentId = jobIdentifier.getExperimentId();
        this.workflowNodeId = jobIdentifier.getWorkflowNodeId();
        this.message = "Received task event , expId : " + jobIdentifier.getExperimentId() + " ,taskId : " + jobIdentifier.getTaskId() + ", wfNodeId : " + jobIdentifier.getWorkflowNodeId() + ", status : " + jobStatusChangeEvent.getState().toString();
    }
}
Also used : TaskStatusChangeEvent(org.apache.airavata.model.messaging.event.TaskStatusChangeEvent) WorkflowIdentifier(org.apache.airavata.model.messaging.event.WorkflowIdentifier) TaskIdentifier(org.apache.airavata.model.messaging.event.TaskIdentifier) ExperimentStatusChangeEvent(org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent) JobStatusChangeEvent(org.apache.airavata.model.messaging.event.JobStatusChangeEvent) JobIdentifier(org.apache.airavata.model.messaging.event.JobIdentifier) WorkflowNodeStatusChangeEvent(org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent)

Aggregations

ExperimentStatusChangeEvent (org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent)2 JobIdentifier (org.apache.airavata.model.messaging.event.JobIdentifier)2 JobStatusChangeEvent (org.apache.airavata.model.messaging.event.JobStatusChangeEvent)2 TaskStatusChangeEvent (org.apache.airavata.model.messaging.event.TaskStatusChangeEvent)2 ProcessIdentifier (org.apache.airavata.model.messaging.event.ProcessIdentifier)1 ProcessStatusChangeEvent (org.apache.airavata.model.messaging.event.ProcessStatusChangeEvent)1 TaskIdentifier (org.apache.airavata.model.messaging.event.TaskIdentifier)1 TaskOutputChangeEvent (org.apache.airavata.model.messaging.event.TaskOutputChangeEvent)1 WorkflowIdentifier (org.apache.airavata.model.messaging.event.WorkflowIdentifier)1 WorkflowNodeStatusChangeEvent (org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent)1