Search in sources :

Example 31 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class SwitchWarmupAction method doSwitch.

public void doSwitch(@Param("pipelineId") Long pipelineId, Navigator nav) throws Exception {
    Channel channel = channelService.findByPipelineId(pipelineId);
    // 尝试重新启动
    arbitrateManageService.channelEvent().restart(channel.getId());
    arbitrateManageService.systemEvent().switchWarmup(channel.getId(), pipelineId);
    nav.redirectToLocation("analysisStageStat.htm?pipelineId=" + pipelineId);
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Example 32 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class SwitchWarmupAction method doRestart.

public void doRestart(@Param("pipelineId") Long pipelineId, Navigator nav) throws Exception {
    Channel channel = channelService.findByPipelineId(pipelineId);
    // 尝试重新启动
    arbitrateManageService.channelEvent().restart(channel.getId());
    // 推送下配置
    channelService.notifyChannel(channel.getId());
    nav.redirectToLocation("analysisStageStat.htm?pipelineId=" + pipelineId);
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Example 33 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class DataMediaPairList method execute.

public void execute(@Param("pipelineId") Long pipelineId, Context context) throws Exception {
    // Pipeline pipeline = pipelineService.findById(pipelineId);
    Channel channel = channelService.findByPipelineId(pipelineId);
    List<DataMediaPair> dataMediaPairs = dataMediaPairService.listByPipelineId(pipelineId);
    Map<Long, TableStat> tableStatMap = new HashMap<Long, TableStat>(dataMediaPairs.size(), 1f);
    List<TableStat> tableStats = tableStatService.listTableStat(pipelineId);
    for (DataMediaPair dataMediaPair : dataMediaPairs) {
        int flag = 0;
        for (TableStat tableStat : tableStats) {
            if (dataMediaPair.getId().equals(tableStat.getDataMediaPairId())) {
                tableStatMap.put(dataMediaPair.getId(), tableStat);
                flag = 1;
                break;
            }
        }
        if (flag == 0) {
            TableStat tableStat = new TableStat();
            tableStat.setFileSize(0L);
            tableStat.setFileCount(0L);
            tableStat.setDeleteCount(0L);
            tableStat.setUpdateCount(0L);
            tableStat.setInsertCount(0L);
            // tableStat.setGmtModified(dataMediaPair.getGmtModified());
            tableStatMap.put(dataMediaPair.getId(), tableStat);
        }
    }
    context.put("dataMediaPairs", dataMediaPairs);
    // 通过PipelineId不能获取到Channel状态,所以需要传递Channel对象
    context.put("channel", channel);
    context.put("pipelineId", pipelineId);
    context.put("tableStatMap", tableStatMap);
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) HashMap(java.util.HashMap) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) TableStat(com.alibaba.otter.shared.common.model.statistics.table.TableStat)

Example 34 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class LogRecordTab method execute.

public void execute(@Param("pageIndex") int pageIndex, @Param("searchKey") String searchKey, @Param("pipelineId") Long pipelineId, Context context) throws Exception {
    @SuppressWarnings("unchecked") Map<String, Object> condition = new HashMap<String, Object>();
    if ("请输入关键字(目前支持log内容关键字搜索)".equals(searchKey)) {
        searchKey = "";
    }
    condition.put("pipelineId", pipelineId);
    condition.put("searchKey", searchKey);
    int count = logRecordService.getCount(condition);
    Paginator paginator = new Paginator();
    paginator.setItems(count);
    paginator.setPage(pageIndex);
    condition.put("offset", paginator.getOffset());
    condition.put("length", paginator.getLength());
    List<LogRecord> logRecords = logRecordService.listByCondition(condition);
    for (LogRecord logRecord : logRecords) {
        if (!StringUtils.isEmpty(logRecord.getMessage())) {
            logRecord.setMessage(logRecord.getMessage().replaceAll("\n\t", "<br/>"));
        }
    }
    context.put("logRecords", logRecords);
    context.put("paginator", paginator);
    context.put("searchKey", searchKey);
    context.put("pipelineId", pipelineId);
    Channel channel = channelService.findByPipelineId(pipelineId);
    context.put("channel", channel);
}
Also used : HashMap(java.util.HashMap) LogRecord(com.alibaba.otter.shared.common.model.config.record.LogRecord) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) Paginator(com.alibaba.citrus.util.Paginator)

Example 35 with Channel

use of com.alibaba.otter.shared.common.model.config.channel.Channel in project otter by alibaba.

the class NodeInfo method execute.

public void execute(@Param("nodeId") Long nodeId, Context context) throws Exception {
    Node node = nodeService.findById(nodeId);
    List<Channel> channels = channelService.listByNodeId(nodeId);
    if (node.getStatus().isStart()) {
        context.put("heapMemoryUsage", nodeRemoteService.getHeapMemoryUsage(nodeId));
        context.put("versionInfo", nodeRemoteService.getNodeVersionInfo(nodeId));
        context.put("systemInfo", nodeRemoteService.getNodeSystemInfo(nodeId));
        context.put("threadActiveSize", nodeRemoteService.getThreadActiveSize(nodeId));
        context.put("threadPoolSize", nodeRemoteService.getThreadPoolSize(nodeId));
        context.put("runningPipelines", nodeRemoteService.getRunningPipelines(nodeId));
    } else {
        context.put("heapMemoryUsage", 0);
        context.put("threadActiveSize", 0);
        context.put("threadPoolSize", 0);
        context.put("runningPipelines", 0);
        context.put("versionInfo", "");
        context.put("systemInfo", "");
    }
    context.put("node", node);
    context.put("channels", channels);
}
Also used : Node(com.alibaba.otter.shared.common.model.config.node.Node) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel)

Aggregations

Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)77 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)38 Mock (mockit.Mock)16 ArrayList (java.util.ArrayList)13 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)10 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)10 ChannelArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent)10 BeforeClass (org.testng.annotations.BeforeClass)10 PipelineArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent)9 InvalidConfigureException (com.alibaba.otter.manager.biz.common.exceptions.InvalidConfigureException)8 NodeArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent)8 Node (com.alibaba.otter.shared.common.model.config.node.Node)7 Event (com.alibaba.otter.shared.communication.core.model.Event)7 Test (org.testng.annotations.Test)7 ChannelStatus (com.alibaba.otter.shared.common.model.config.channel.ChannelStatus)6 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)6 HashMap (java.util.HashMap)6 ChannelDO (com.alibaba.otter.manager.biz.config.channel.dal.dataobject.ChannelDO)5 SystemParameter (com.alibaba.otter.shared.common.model.config.parameter.SystemParameter)5 Identity (com.alibaba.otter.shared.etl.model.Identity)5