X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fdata%2Fprocessing%2Fccn%2Fparser.py;h=9b83a4cfe7d80255c5556cf81bc041912fca037c;hb=d16b306c7ee05bd2f068966bead8906526368162;hp=e3c1007a833ee4d25e5e8f88de983cff58aa6f58;hpb=eded31621014dab59ec5b22a99ed63e52ae759c1;p=nepi.git diff --git a/src/nepi/data/processing/ccn/parser.py b/src/nepi/data/processing/ccn/parser.py index e3c1007a..9b83a4cf 100644 --- a/src/nepi/data/processing/ccn/parser.py +++ b/src/nepi/data/processing/ccn/parser.py @@ -209,6 +209,8 @@ def annotate_cn_graph(logs_dir, graph, parse_ping_logs = False): for ip in ips: ips2nid[ip] = nid + found_files = False + # Now walk through the ccnd logs... for dirpath, dnames, fnames in os.walk(logs_dir): # continue if we are not at the leaf level (if there are subdirectories) @@ -222,6 +224,7 @@ def annotate_cn_graph(logs_dir, graph, parse_ping_logs = False): for fname in fnames: if fname.endswith(".log"): + found_files = True filename = os.path.join(dirpath, fname) data = parse_file(filename) annotate_cn_node(graph, nid, ips2nid, data, content_history) @@ -231,6 +234,10 @@ def annotate_cn_graph(logs_dir, graph, parse_ping_logs = False): fname = dump_content_history(content_history) graph.node[nid]["history"] = fname + if not found_files: + msg = "No CCND output files were found to parse at %s " % logs_dir + raise RuntimeError, msg + if parse_ping_logs: ping_parser.annotate_cn_graph(logs_dir, graph) @@ -365,7 +372,7 @@ def process_content_history(graph): interest_count, content_count) -def process_content_history_logs(logs_dir, graph): +def process_content_history_logs(logs_dir, graph, parse_ping_logs = False): """ Parse CCN logs and aggregate content history information in graph. Returns annotated graph and message countn and content names history. @@ -373,7 +380,7 @@ def process_content_history_logs(logs_dir, graph): ## Process logs and analyse data try: graph = annotate_cn_graph(logs_dir, graph, - parse_ping_logs = True) + parse_ping_logs = parse_ping_logs) except: print "Skipping: Error parsing ccnd logs", logs_dir raise