Search in sources :

Example 1 with RuleExecutor

use of org.smartdata.server.engine.rule.RuleExecutor in project SSM by Intel-bigdata.

the class RuleManager method start.

/**
 * Start services.
 */
@Override
public void start() throws IOException {
    LOG.info("Starting ...");
    // after StateManager be ready
    int numLaunched = 0;
    // Submit runnable rules to scheduler
    for (RuleInfoRepo infoRepo : mapRules.values()) {
        RuleInfo rule = infoRepo.getRuleInfoRef();
        if (rule.getState() == RuleState.ACTIVE || rule.getState() == RuleState.DRYRUN) {
            RuleExecutor ruleExecutor = infoRepo.launchExecutor(this);
            TranslateResult tr = ruleExecutor.getTranslateResult();
            TimeBasedScheduleInfo si = tr.getTbScheduleInfo();
            if (rule.getLastCheckTime() != 0) {
                si.setFirstCheckTime(rule.getLastCheckTime());
            }
            boolean sub = submitRuleToScheduler(ruleExecutor);
            numLaunched += sub ? 1 : 0;
        }
    }
    LOG.info("Started. " + numLaunched + " rules launched for execution.");
}
Also used : RuleInfoRepo(org.smartdata.server.engine.rule.RuleInfoRepo) RuleExecutor(org.smartdata.server.engine.rule.RuleExecutor) TranslateResult(org.smartdata.model.rule.TranslateResult) DetailedRuleInfo(org.smartdata.model.DetailedRuleInfo) RuleInfo(org.smartdata.model.RuleInfo) TimeBasedScheduleInfo(org.smartdata.model.rule.TimeBasedScheduleInfo)

Aggregations

DetailedRuleInfo (org.smartdata.model.DetailedRuleInfo)1 RuleInfo (org.smartdata.model.RuleInfo)1 TimeBasedScheduleInfo (org.smartdata.model.rule.TimeBasedScheduleInfo)1 TranslateResult (org.smartdata.model.rule.TranslateResult)1 RuleExecutor (org.smartdata.server.engine.rule.RuleExecutor)1 RuleInfoRepo (org.smartdata.server.engine.rule.RuleInfoRepo)1