Search in sources :

Example 1 with TaskStartEvent

use of com.alibaba.jstorm.daemon.nimbus.metric.assignment.TaskStartEvent in project jstorm by alibaba.

the class TopologyAssign method pushTaskStartEvent.

protected void pushTaskStartEvent(Assignment oldAssignment, Assignment newAssignment, TopologyAssignEvent event) throws Exception {
    // notify jstorm monitor on task assign/reassign/rebalance
    TaskStartEvent taskEvent = new TaskStartEvent();
    taskEvent.setOldAssignment(oldAssignment);
    taskEvent.setNewAssignment(newAssignment);
    taskEvent.setTopologyId(event.getTopologyId());
    Map<Integer, String> task2Component;
    // get from nimbus cache first
    Map<Integer, TaskInfo> taskInfoMap = Cluster.get_all_taskInfo(nimbusData.getStormClusterState(), event.getTopologyId());
    if (taskInfoMap != null) {
        task2Component = Common.getTaskToComponent(taskInfoMap);
    } else {
        task2Component = Common.getTaskToComponent(Cluster.get_all_taskInfo(nimbusData.getStormClusterState(), event.getTopologyId()));
    }
    taskEvent.setTask2Component(task2Component);
    ClusterMetricsRunnable.pushEvent(taskEvent);
}
Also used : TaskInfo(com.alibaba.jstorm.task.TaskInfo) TaskStartEvent(com.alibaba.jstorm.daemon.nimbus.metric.assignment.TaskStartEvent)

Aggregations

TaskStartEvent (com.alibaba.jstorm.daemon.nimbus.metric.assignment.TaskStartEvent)1 TaskInfo (com.alibaba.jstorm.task.TaskInfo)1