def pc_log(conf, top_dt, end_dt, dur, area): _logger.info("job start ({0} - {1} in {2})".format(top_dt, end_dt, area)) edict, evmap = log2event.get_edict(conf, top_dt, end_dt, dur, area) _logger.info("{0} events found in given term of log data".format( len(edict))) if len(edict) > 2: threshold = conf.getfloat("dag", "threshold") ci_func = conf.get("dag", "ci_func") bin_overlap = conf.getdur("dag", "stat_bin_overlap") if bin_overlap is None or bin_overlap == "": bin_overlap = datetime.timedelta(seconds=0) binarize = pc_input.input_binarize(ci_func) data = log2event.event2stat(edict, top_dt, end_dt, dur, binarize, bin_overlap) skel_method = conf.get("dag", "skeleton_method") skel_verbose = conf.getboolean("dag", "skeleton_verbose") pc_depth = conf.getint("dag", "skeleton_depth") graph = pc_input.pc(data, threshold, ci_func, skel_method, pc_depth, skel_verbose) else: _logger.info("insufficient events({0}), return empty dag".format(\ len(edict))) graph = pcresult.empty_dag() output = pcresult.PCOutput(conf) output.make(graph, evmap, top_dt, end_dt, dur, area) output.dump() _logger.info("job done, output {0}".format(output.filename)) return output
def pc_log(conf, top_dt, end_dt, dur, area, dump = True): _logger.info("job start ({0} - {1} in {2})".format(top_dt, end_dt, area)) edict, evmap = get_edict(conf, top_dt, end_dt, dur, area) _logger.info("{0} events found in given term of log data".format( len(edict))) if dump: tempfn = thread_name(conf, top_dt, end_dt, dur, area) + ".temp" with open(tempfn, 'w') as f: pickle.dump((edict, evmap), f) if len(edict) > 2: threshold = conf.getfloat("dag", "threshold") ci_func = conf.get("dag", "ci_func") binarize = pc_input.input_binarize(ci_func) data = log2event.event2stat(edict, top_dt, end_dt, dur, binarize) graph = pc_input.pc(data, threshold, ci_func) else: _logger.info("insufficient events({0}), return empty dag".format(\ len(edict))) graph = pcresult.empty_dag() output = pcresult.PCOutput(conf) output.make(graph, evmap, top_dt, end_dt, dur, area) if dump: output.dump() common.rm(tempfn) _logger.info("job done, output {0}".format(output.filename)) return output
def pc_log(conf, top_dt, end_dt, dur, area): _logger.info("job start ({0} - {1} in {2})".format(top_dt, end_dt, area)) edict, evmap = log2event.log2event(conf, top_dt, end_dt, dur, area) _logger.info("{0} events found in given term of log data".format( len(edict))) if len(edict) > 2: threshold = conf.getfloat("dag", "threshold") graph = pc_input.pc(edict, threshold) else: _logger.info("insufficient events({0}), return empty dag".format(\ len(edict))) graph = pc_input.empty_dag() output = pcresult.PCOutput(conf) output.make(graph, evmap, top_dt, end_dt, dur, area) output.dump() _logger.info("job done, output {0}".format(output.filename)) return output