Search in sources :

Example 86 with Pipeline

use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.

the class PipelineServiceImpl method listByNodeId.

public List<Pipeline> listByNodeId(Long nodeId) {
    Assert.assertNotNull(nodeId);
    List<Pipeline> pipelines = new ArrayList<Pipeline>();
    try {
        List<PipelineNodeRelationDO> relations = pipelineNodeRelationDao.listByNodeId(nodeId);
        if (relations.isEmpty()) {
            logger.debug("DEBUG ## query the relation by nodeId:" + nodeId + " return null,maybe hasn't create any relations.");
            return pipelines;
        }
        List<Long> piplineIds = new ArrayList<Long>();
        for (PipelineNodeRelationDO relation : relations) {
            piplineIds.add(relation.getPipelineId());
        }
        List<PipelineDO> pipelineDos = pipelineDao.listByMultiId(piplineIds.toArray(new Long[piplineIds.size()]));
        if (pipelineDos.isEmpty()) {
            String exceptionCause = "query the pipelines by pipelineIds:" + piplineIds.toString() + " return null!";
            logger.error("ERROR ## " + exceptionCause);
            throw new ManagerException(exceptionCause);
        }
        pipelines = doToModel(pipelineDos);
    } catch (Exception e) {
        logger.error("ERROR ## query the pipelines by nodeId:" + nodeId + " has an exception!");
        throw new ManagerException(e);
    }
    return pipelines;
}
Also used : ArrayList(java.util.ArrayList) PipelineDO(com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) PipelineNodeRelationDO(com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineNodeRelationDO)

Example 87 with Pipeline

use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.

the class PipelineServiceImpl method listByIds.

@Override
public List<Pipeline> listByIds(Long... identities) {
    List<Pipeline> pipelines = new ArrayList<Pipeline>();
    try {
        List<PipelineDO> pipelineDos = new ArrayList<PipelineDO>();
        if (identities.length < 1) {
            pipelineDos = pipelineDao.listAll();
            if (pipelineDos.isEmpty()) {
                logger.debug("DEBUG ## couldn't query any pipeline, maybe hasn't create any pipeline.");
                return pipelines;
            }
        } else {
            pipelineDos = pipelineDao.listByMultiId(identities);
            if (pipelineDos.isEmpty()) {
                String exceptionCause = "couldn't query any pipeline by pipelineIds:" + Arrays.toString(identities);
                logger.error("ERROR ## " + exceptionCause);
                throw new ManagerException(exceptionCause);
            }
        }
        pipelines = doToModel(pipelineDos);
    } catch (Exception e) {
        logger.error("ERROR ## query pipelines has an exception!");
        throw new ManagerException(e);
    }
    return pipelines;
}
Also used : ArrayList(java.util.ArrayList) PipelineDO(com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Example 88 with Pipeline

use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.

the class PipelineServiceImpl method listByChannelIdsWithoutOther.

public List<Pipeline> listByChannelIdsWithoutOther(Long... channelIds) {
    Assert.assertNotNull(channelIds);
    List<Pipeline> pipelines = new ArrayList<Pipeline>();
    try {
        List<PipelineDO> pipelineDos = pipelineDao.listByChannelIds(channelIds);
        if (pipelineDos.isEmpty()) {
            logger.debug("DEBUG ## query pipeline by channelId:" + channelIds + " return null.");
            return pipelines;
        }
        pipelines = doToModelWithoutOther(pipelineDos);
    } catch (Exception e) {
        logger.error("ERROR ## query pipelines by channelIds:" + channelIds.toString() + " has an exception!");
        throw new ManagerException(e);
    }
    return pipelines;
}
Also used : ArrayList(java.util.ArrayList) PipelineDO(com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Example 89 with Pipeline

use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.

the class PipelineServiceImpl method listByDestinationWithoutOther.

public List<Pipeline> listByDestinationWithoutOther(String destination) {
    Assert.assertNotNull(destination);
    List<Pipeline> pipelines = new ArrayList<Pipeline>();
    try {
        List<PipelineDO> pipelineDos = pipelineDao.listByDestinationCondition(destination);
        if (pipelineDos.isEmpty()) {
            logger.debug("DEBUG ## query pipeline by destination:" + destination + " return null.");
            return pipelines;
        }
        pipelines = doToModelWithoutOther(pipelineDos);
    } catch (Exception e) {
        logger.error("ERROR ## query pipelines by destination:" + destination + " has an exception!");
        throw new ManagerException(e);
    }
    return pipelines;
}
Also used : ArrayList(java.util.ArrayList) PipelineDO(com.alibaba.otter.manager.biz.config.pipeline.dal.dataobject.PipelineDO) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) ManagerException(com.alibaba.otter.manager.biz.common.exceptions.ManagerException) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Example 90 with Pipeline

use of com.alibaba.otter.shared.common.model.config.pipeline.Pipeline in project otter by alibaba.

the class RestartAlarmRecovery method recovery.

public void recovery(AlarmRule alarmRule, long alarmCount) {
    if (alarmCount >= alarmRule.getRecoveryThresold()) {
        synchronized (queue) {
            // 做异步处理,避免并发时重复执行recovery
            Pipeline pipeline = pipelineService.findById(alarmRule.getPipelineId());
            // 超过2倍阀值,强制停止一下通道释放一下内存
            // recovery的下一次启用修复
            boolean needStop = (alarmCount >= alarmRule.getRecoveryThresold() + 1);
            AlarmRecoveryDelayed delayed = new AlarmRecoveryDelayed(pipeline.getChannelId(), alarmRule.getId(), needStop, checkTime);
            if (!queue.contains(delayed)) {
                queue.add(delayed);
            }
        }
    }
}
Also used : Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Aggregations

Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)105 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)38 ArrayList (java.util.ArrayList)37 Node (com.alibaba.otter.shared.common.model.config.node.Node)22 Test (org.testng.annotations.Test)20 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)19 EventData (com.alibaba.otter.shared.etl.model.EventData)19 Mock (mockit.Mock)19 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)17 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)17 Identity (com.alibaba.otter.shared.etl.model.Identity)12 RowBatch (com.alibaba.otter.shared.etl.model.RowBatch)12 BaseDbTest (com.alibaba.otter.node.etl.BaseDbTest)10 ChannelArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent)10 PipelineArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent)9 PipelineParameter (com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter)9 FileBatch (com.alibaba.otter.shared.etl.model.FileBatch)9 FileData (com.alibaba.otter.shared.etl.model.FileData)9 HashMap (java.util.HashMap)9 BeforeClass (org.testng.annotations.BeforeClass)9