Commit 06e54c74 authored by Marc Vef's avatar Marc Vef
Browse files

Some eval python scripts added

parent c264a827
Loading
Loading
Loading
Loading
+72 −0
Original line number Diff line number Diff line
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import argparse

import os

__author__ = "Marc-Andre Vef"
__email__ = "vef@uni-mainz.de"

nodes = list()


def parse_file(filepath):
    n = 0
    nodes_tmp = list()
    with open(filepath, 'r') as rf:
        for line in rf.readlines():
            if 'Startup successful. Daemon is ready.' in line:
                n += 1
            if '[SUCCESS]' in line:
                nodes_tmp.append(int(line.strip().split()[-1][1:]))
            if 'DAEMON STOP' in line:
                break
    # put create stat and remove into dict index 0: avg, index 1 std
    nodes_tmp.sort(key=lambda x: x)
    nodes.append(nodes_tmp)


def parse_ior_out(inpath, faulty_node_set):
    if not os.path.exists(inpath) or not os.path.isdir(inpath):
        print "Input path does not exist or is not a directory. Exiting."
        exit(1)
    # parse input
    in_depth = inpath.count(os.path.sep)
    for root, dirs, files in os.walk(inpath):
        curr_depth = root.count(os.path.sep)
        if curr_depth > in_depth:
            break
        for file in files:
            filepath = '%s/%s' % (root, file)
            parse_file(filepath)
    nodes.sort(key=lambda x: len(x))
    faulty_index = -1
    for i, n in enumerate(nodes):
        if len(n) == faulty_node_set:
            faulty_index = i
    tmp_set = set(nodes[faulty_index])
    for i, n in enumerate(nodes):
        if i == faulty_index:
            continue
        tmp_set = tmp_set.difference(set(n))
    tmp_set = list(tmp_set)
    tmp_set.sort()
    print ','.join(map(str, tmp_set))


if __name__ == "__main__":
    # Init parser
    parser = argparse.ArgumentParser(description='This scripts returns a sorted number of nodes used in IOR ',
                                     formatter_class=argparse.RawTextHelpFormatter)
    # positional arguments
    parser.add_argument('ior_in_path', type=str,
                        help='path to the ior out input file. If its a directory it will process all files in it.')
    parser.add_argument('nodes_number_to_intersect', type=int,
                        help='nodes_number_to_intersect')

    args = parser.parse_args()

    parse_ior_out(args.ior_in_path, args.nodes_number_to_intersect)

    print '\nNothing left to do; exiting. :)'
+33 −0
Original line number Diff line number Diff line
# #cache 4m
# a = [7,12,13,16,18,28,40,41,67,68,76,77,78,79,80,81,94,95,96,101,102,103,104,110,111,112,125,170,171,172,173,212,213,214,257,258,259,293,294,295,311,312,313,315,320,325,326,331,336,346,354,355,356,357,466,467,468,481,502,503,504,552,553,554]
#
# #cache 512k
# b1 = [181,182,428,429,437,438,439,440,441,442,443,444,447,448,456,457]
# b2 = [7,11,12,13,40,41,67,68,76,77,78,80,81,94,95,101,102,103,104,110,122,123,124,125,170,171,172,212,213,257,259,294,295,313,324,325,466,467,468,479,480,481,482,502,504]
# b3 = [7,24,27,38,40,41,57,65,67,68,71,73,76,77,78,80,81,83,94,98,99,101,102,103,104,108,110,116,119,125,130,135,136,138,139,144,147,150,152,153,161,163,165,170,171,172,176,177,181,182,187,190,194,200,206,208,213,216,224,226,227,253,257,259,267,268,269,283,294,295,297,300,305,313,325,347,420,421,427,428,429,456,457,466,467,468,502,504]
#
# #cache 16m
# c1 = [7,11,12,13,14,40,41,67,68,78,79,95,96,98,99,101,102,103,104,116,117,121,122,152,153,156,157,158,170,171,172,173,176,177,189,190,202,203,205,206,212,213,214,223,224,289,290,297,298,299,300,311,312,313,324,325,326,466,467,468,502,503,504]
# c2 = [7,11,12,13,40,41,67,68,76,77,78,79,80,94,95,96,98,99,101,102,103,104,110,111,112,116,117,150,152,153,157,158,161,163,165,170,171,172,173,176,177,187,189,190,194,198,200,202,203,205,206,208,210,212,213,214,216,218,223,224,229,241,247,257,258,259,261,274,276,278,283,289,293,297,299,300,311,312,313,325,326,356,357,466,467,468,479,480,481,482,502,503,504,552,553,554]
#
# final_set = set(a).intersection(set(b2))
# # final_set = final_set.intersection(set(b2))
# final_set = final_set.intersection(set(b3))
# final_set = final_set.intersection(set(c1))
# final_set = final_set.intersection(set(c2))
# print sorted(final_set)

suspects = [7, 40, 41, 67, 68, 78, 101, 102, 103, 104, 170, 171, 172, 213, 313, 325, 466, 467, 468, 502, 504]
d = [11, 12, 13, 14, 101, 102, 103, 104, 110, 111, 112, 121, 122, 123, 124, 125, 156, 157, 158, 170, 171, 172, 173, 212,
     213, 214, 223, 224, 225, 226, 227, 257, 258, 259, 289, 290, 291, 297, 298, 299, 300, 311, 312, 313, 324, 325, 326,
     354, 355, 356, 357, 466, 467, 468, 479, 480, 481, 482, 502, 503, 504, 552, 553, 554]
e = [57, 58, 59, 60, 95, 96, 101, 102, 103, 104, 110, 111, 112, 122, 123, 124, 130, 135, 136, 138, 139, 144, 156, 157,
     158, 159, 160, 165, 166, 167, 170, 171, 172, 176, 177, 181, 182, 183, 202, 203, 216, 217, 218, 223, 224, 225, 226,
     227, 231, 232, 253, 254, 257, 258, 259, 269, 270, 276, 289, 290, 291, 294, 295, 297, 298, 299, 300, 301, 302, 305,
     306, 307, 308, 309, 311, 312, 313, 319, 322, 324, 325, 326, 328, 334, 342, 346, 354, 355, 356, 357, 386, 396, 397,
     398, 399, 403, 405, 406, 408, 420, 421, 425, 426, 427, 456, 457, 467, 468, 479, 480, 481, 482, 494, 495, 496, 497,
     498, 499, 502, 503, 504, 510, 519, 520, 537, 552, 553, 554]

final_set = set(suspects).intersection(set(d))
final_set = final_set.intersection(set(d))
print sorted(final_set)