def __init__(self):
     Parser.__init__(self)
     self.add_pattern(
         "successor_generator_time",
         "Building successor generator...done! \[t=(.+)s\]",
         required=False,
         type=float)
Exemple #2
0
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern(
         "init_time",
         "Best heuristic value: \d+ \[g=0, 1 evaluated, 0 expanded, t=(.+)s, \d+ KB\]",
         required=True,
         type=float)
Exemple #3
0
    def __init__(self):
        Parser.__init__(self)

        self.add_pattern(
            "planner_time_limit",
            r"planner time limit: (.+)s",
            type=float,
        )
        self.add_pattern(
            "planner_memory_limit",
            r"planner memory limit: (.+) MB",
            type=int,
        )
        self.add_pattern("node",
                         r"node: (.+)\n",
                         type=str,
                         file="driver.log",
                         required=True)
        self.add_pattern(
            "planner_time",
            r"Planner time: (.+)s",
            type=float,
        )
        self.add_pattern(
            "planner_wall_clock_time",
            r"planner wall-clock time: (.+)s",
            type=float,
            file="driver.log",
            required=True,
        )

        self.add_function(add_planner_memory)
        self.add_function(add_planner_time)
        self.add_function(add_planner_scores)
    def __init__(self):
        Parser.__init__(self)

        self.add_function(get_iterative_results)
        self.add_function(coverage)
        self.add_function(unsolvable)
        self.add_function(get_error)
Exemple #5
0
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern('planner_exit_code',
                      r'planner exit code: (.+)\n',
                      type=int,
                      file='driver.log',
                      required=True)
     self.add_function(parse_exit_code)
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern('bytes_per_state', 'Bytes per state: (\d+)',
                     required=False, type=int)
     self.add_pattern('state_var_t_size', 'Dispatcher selected state size (\d).',
                     required=False, type=int)
     self.add_pattern('variables', 'Variables: (\d+)',
                     required=False, type=int)
     self.add_function(calculate_old_state_size)
Exemple #7
0
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern(
         "planner_exit_code",
         r"planner exit code: (.+)\n",
         type=int,
         file="driver.log",
         required=True,
     )
     self.add_function(parse_exit_code)
Exemple #8
0
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern("num_sga_patterns",
                      "Found (\d+) SGA patterns.",
                      required=False,
                      type=int)
     self.add_pattern("num_interesting_patterns",
                      "Found (\d+) interesting patterns.",
                      required=False,
                      type=int)
Exemple #9
0
    def __init__(self):
        Parser.__init__(self)

        for name, pattern, typ in PATTERNS:
            self.add_pattern(name, pattern, type=typ)

        self.add_function(check_single_search)
        self.add_function(add_coverage)
        self.add_function(add_memory)
        self.add_function(add_initial_h_values)
        self.add_function(ensure_minimum_times)
        self.add_function(add_scores)
Exemple #10
0
 def add_pattern(self,
                 name,
                 regex,
                 file="run.log",
                 required=False,
                 type=int,
                 flags=""):
     Parser.add_pattern(self,
                        name,
                        regex,
                        file=file,
                        required=required,
                        type=type,
                        flags=flags)
Exemple #11
0
    def __init__(self):
        Parser.__init__(self)
        self.add_function(add_planner_memory)
        self.add_function(add_planner_time)

        self.add_pattern('node',
                         r'node: (.+)\n',
                         type=str,
                         file='driver.log',
                         required=True)
        self.add_pattern('planner_wall_clock_time',
                         r'planner wall-clock time: (.+)s',
                         type=float,
                         file='driver.log',
                         required=True)
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern('bytes_per_state',
                      'Bytes per state: (\d+)',
                      required=False,
                      type=int)
     self.add_pattern('state_var_t_size',
                      'Dispatcher selected state size (\d).',
                      required=False,
                      type=int)
     self.add_pattern('variables',
                      'Variables: (\d+)',
                      required=False,
                      type=int)
     self.add_function(calculate_old_state_size)
Exemple #13
0
def main():
    parser = Parser()
    parser.add_pattern("int_hash_set_load_factor",
                       "Int hash set load factor: \d+/\d+ = (.+)",
                       required=False,
                       type=float)
    parser.add_pattern("int_hash_set_resizes",
                       "Int hash set resizes: (\d+)",
                       required=False,
                       type=int)
    print "Running custom parser"
    parser.parse()
Exemple #14
0
    def __init__(self):
        Parser.__init__(self)

        self.add_pattern('node',
                         r'node: (.+)\n',
                         type=str,
                         file='driver.log',
                         required=True)
        self.add_pattern('planner_exit_code',
                         r'run-planner exit code: (.+)\n',
                         type=int,
                         file='driver.log')

        self.add_function(parse_memory_time_watchpoints, file="run.log")
        self.add_function(parse_grounding_info, file="run.log")
        self.add_function(parse_node_generation_rate, file="run.log")
        self.add_function(parse_sdd_minimization, file="run.log")
        self.add_function(parse_simulation_info, file="run.log")

        self.add_function(parse_results, file="results.json")
        self.add_function(check_min_values, file="results.json")
Exemple #15
0
def main():
    print 'Running custom parser'
    parser = Parser()
    parser.add_pattern('time_for_pruning_operators',
                       r'^Time for pruning operators: (.+)s$',
                       type=float,
                       flags="M")
    parser.parse()
#! /usr/bin/env python

from lab.parser import Parser

print("Running average split parser")
parser = Parser()
parser.add_pattern("average_split_options",
                   r"Average number of possible splits: (.+)",
                   type=float)
parser.add_pattern("average_distinct_rated",
                   r"Average number of distinct ratings: (.+)",
                   type=float)
parser.parse()
def main():
    print("Running singularity parser")
    parser = Parser()
    parser.add_pattern(
        "planner_exit_code",
        r"run-planner exit code: (.+)\n",
        type=int,
        file="driver.log",
        required=True,
    )
    parser.add_pattern("node",
                       r"node: (.+)\n",
                       type=str,
                       file="driver.log",
                       required=True)
    parser.add_pattern(
        "planner_wall_clock_time",
        r"run-planner wall-clock time: (.+)s",
        type=float,
        file="driver.log",
        required=True,
    )
    parser.add_pattern("runtime", r"Singularity runtime: (.+?)s", type=float)
    parser.add_pattern(
        "time_limit",
        r"Enforcing CPUTime limit \(soft limit, will send "
        r"SIGTERM then SIGKILL\): (\d+) seconds",
        type=int,
        file="watch.log",
        required=True,
    )
    # Cumulative runtime and virtual memory of the solver and all child processes.
    parser.add_pattern("runtime",
                       r"WCTIME=(.+)",
                       type=float,
                       file="values.log",
                       required=True)
    parser.add_pattern("virtual_memory",
                       r"MAXVM=(\d+)",
                       type=int,
                       file="values.log",
                       required=True)
    parser.add_pattern("raw_memory", r"Peak memory: (\d+) KB", type=int)
    parser.add_pattern("cost", r"\nFinal value: (.+)\n", type=int)
    parser.add_function(coverage)
    parser.add_function(unsolvable)
    parser.add_function(parse_g_value_over_time)
    parser.add_function(set_outcome, file="values.log")
    parser.parse()
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int)
parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float)
parser.add_pattern('ms_memory_delta', 'Final peak memory increase of merge-and-shrink computation: (\d+) KB', required=False, type=int)

def check_ms_constructed(content, props):
    ms_construction_time = props.get('ms_construction_time')
    abstraction_constructed = False
    if ms_construction_time is not None:
        abstraction_constructed = True
    props['ms_abstraction_constructed'] = abstraction_constructed

parser.add_function(check_ms_constructed)

def check_planner_exit_reason(content, props):
    ms_abstraction_constructed = props.get('ms_abstraction_constructed')
    error = props.get('error')
    if error != 'none' and error != 'timeout' and error != 'out-of-memory':
        print 'error: %s' % error
        return

    # Check whether merge-and-shrink computation or search ran out of
    # time or memory.
    ms_out_of_time = False
    ms_out_of_memory = False
    search_out_of_time = False
    search_out_of_memory = False
Exemple #19
0
 def __init__(self):
     Parser.__init__(self)
     self.add_preprocess_parsing()
     self.add_preprocess_functions()
Exemple #20
0
def main():
    print "Running custom parser"
    parser = Parser()
    parser.add_pattern("pdb_collection_construction_time",
                       "^PDB collection construction time: (.+)s$",
                       type=float,
                       flags="M",
                       required=False)
    parser.add_pattern("dominance_pruning_time",
                       "^Dominance pruning took (.+)s$",
                       type=float,
                       flags="M",
                       required=False)
    parser.add_pattern("dominance_pruning_pruned_subsets",
                       "Pruned (\d+) of \d+ maximal additive subsets",
                       type=int,
                       required=False)
    parser.add_pattern("dominance_pruning_pruned_pdbs",
                       "Pruned (\d+) of \d+ PDBs",
                       type=int,
                       required=False)
    parser.add_function(add_dominance_pruning_failed)
    parser.parse()
    return reduce_to_minimum


def add_list_pattern(parser, name, regex, file="run.log", flags="M"):
    """
    *regex* must contain at most one group.
    """
    flags = _get_flags(flags)

    def parse_repeated_list(content, props):
        matches = re.findall(regex, content, flags=flags)
        attr_list = []
        for m in matches:
            items = m.split()
            items = [float(i) for i in items]
            attr_list.append(items)
        props[name] = attr_list

    parser.add_function(parse_repeated_list, file=file)


print("Running Prost parser.")
parser = Parser()
for name, pattern, pattern_type in SINGLE_PATTERNS:
    parser.add_pattern(name, pattern, type=pattern_type)
for name, pattern, pattern_type in REPEATED_PATTERNS:
    add_repeated_pattern(parser, name, pattern, type=pattern_type)
for name, pattern in LIST_PATTERNS:
    add_list_pattern(parser, name, pattern)
parser.parse()
Exemple #22
0
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('ms_final_size',
                   'Final transition system size: (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('ms_construction_time',
                   'Merge-and-shrink algorithm runtime: (.+)s',
                   required=False,
                   type=float)
parser.add_pattern(
    'ms_atomic_construction_time',
    't=(.+)s \(after computation of atomic transition systems\)',
    required=False,
    type=float)
parser.add_pattern(
    'ms_memory_delta',
    'Final peak memory increase of merge-and-shrink computation: (\d+) KB',
    required=False,
    type=int)


def check_ms_constructed(content, props):
    ms_construction_time = props.get('ms_construction_time')
    abstraction_constructed = False
    if ms_construction_time is not None:
        abstraction_constructed = True
    props['ms_abstraction_constructed'] = abstraction_constructed
def main():
    print("Running singularity parser")
    parser = Parser()
    parser.add_pattern(
        "planner_exit_code",
        r"run-planner exit code: (.+)\n",
        type=int,
        file="driver.log",
        required=True,
    )
    parser.add_pattern(
        "node", r"node: (.+)\n", type=str, file="driver.log", required=True
    )
    parser.add_pattern(
        "planner_wall_clock_time",
        r"run-planner wall-clock time: (.+)s",
        type=float,
        file="driver.log",
        required=True,
    )
    parser.add_pattern("search_time", r"Search time: (.+)s", type=float)
    parser.add_pattern("total_time", r"Total time: (.+)s\n", type=float)
    # The Singularity runtime only has a granularity of seconds.
    parser.add_pattern("singularity_runtime", r"Singularity runtime: (.+)s", type=int)
    parser.add_pattern("raw_memory", r"Peak memory: (\d+) KB", type=int)
    parser.add_pattern("cost", r"\nFinal value: (.+)\n", type=int)
    parser.add_function(coverage)
    parser.add_function(unsolvable)
    parser.add_function(error)
    parser.parse()
Exemple #24
0
    def __init__(self):
        Parser.__init__(self)

        for name, pattern, typ in PATTERNS:
            self.add_pattern(name, pattern, type=typ)
Exemple #25
0
    props['coverage'] = int(props['planner_exit_code'] == 0)


def get_plan(content, props):
    # All patterns are parsed before functions are called.
    if props.get('evaluations') is not None:
        props['plan'] = re.findall(r'^(?:step)?\s*\d+: (.+)$', content, re.M)


def get_times(content, props):
    props['times'] = re.findall(r'(\d+\.\d+) seconds', content)


def trivially_unsolvable(content, props):
    props['trivially_unsolvable'] = int(
        'ff: goal can be simplified to FALSE. No plan will solve it' in content)


parser = Parser()
parser.add_pattern(
    'node', r'node: (.+)\n', type=str, file='driver.log', required=True)
parser.add_pattern(
    'planner_exit_code', r'run-planner exit code: (.+)\n', type=int, file='driver.log')
parser.add_pattern('evaluations', r'evaluating (\d+) states')
parser.add_function(error)
parser.add_function(coverage)
parser.add_function(get_plan)
parser.add_function(get_times)
parser.add_function(trivially_unsolvable)
parser.parse()
Exemple #26
0
#! /usr/bin/env python

import math

from lab.parser import Parser


def diff(content, props):
    pi = props.get("pi")
    props["diff"] = abs(math.pi - pi)


parser = Parser()
parser.add_pattern("pi", "Pi: (.+)", type=float)
parser.add_pattern("time", "Time: (.+)", type=float)
parser.add_function(diff)
parser.parse()
Exemple #27
0
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('ms_final_size',
                   'Final transition system size: (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('ms_construction_time',
                   'Done initializing merge-and-shrink heuristic \[(.+)s\]',
                   required=False,
                   type=float)
parser.add_pattern(
    'ms_memory_delta',
    'Final peak memory increase of merge-and-shrink computation: (\d+) KB',
    required=False,
    type=int)
parser.add_pattern('actual_search_time',
                   'Actual search time: (.+)s \[t=.+s\]',
                   required=False,
                   type=float)


def check_ms_constructed(content, props):
    ms_construction_time = props.get('ms_construction_time')
    abstraction_constructed = False
    if ms_construction_time is not None:
        abstraction_constructed = True
    props['ms_abstraction_constructed'] = abstraction_constructed
Exemple #28
0
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('ms_construction_time', 'Merge-and-shrink algorithm runtime: (.+)s', required=False, type=float)
parser.add_pattern('ms_atomic_construction_time', 'M&S algorithm timer: (.+)s \(after computation of atomic factors\)', required=False, type=float)
parser.add_pattern('ms_memory_delta', 'Final peak memory increase of merge-and-shrink algorithm: (\d+) KB', required=False, type=int)
parser.add_pattern('ms_num_remaining_factors', 'Number of remaining factors: (\d+)', required=False, type=int)
parser.add_pattern('ms_num_factors_kept', 'Number of factors kept: (\d+)', required=False, type=int)

def check_ms_constructed(content, props):
    ms_construction_time = props.get('ms_construction_time')
    abstraction_constructed = False
    if ms_construction_time is not None:
        abstraction_constructed = True
    props['ms_abstraction_constructed'] = abstraction_constructed

parser.add_function(check_ms_constructed)

def check_atomic_fts_constructed(content, props):
    ms_atomic_construction_time = props.get('ms_atomic_construction_time')
    ms_atomic_fts_constructed = False
    if ms_atomic_construction_time is not None:
        ms_atomic_fts_constructed = True
    props['ms_atomic_fts_constructed'] = ms_atomic_fts_constructed

parser.add_function(check_atomic_fts_constructed)

def check_planner_exit_reason(content, props):
    ms_abstraction_constructed = props.get('ms_abstraction_constructed')
 def __init__(self):
     Parser.__init__(self)
     self.add_pattern("raw_memory", r"Peak memory: (.+) KB", type=int, required=False)
Exemple #30
0
from lab.parser import Parser


def add_absolute_and_relative(parser, attribute, pattern):
    parser.add_pattern(attribute,
                       pattern + ' (\d+) .+',
                       required=False,
                       type=int)
    parser.add_pattern(attribute + '_rel',
                       pattern + ' \d+ \((.+)\)',
                       required=False,
                       type=float)


parser = Parser()

parser.add_pattern('sg_construction_time',
                   'SG construction time: (.+)s',
                   required=False,
                   type=float)
parser.add_pattern('sg_peak_mem_diff',
                   'SG construction peak memory difference: (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('sg_size_estimate_total',
                   'SG size estimates: total: (\d+)',
                   required=False,
                   type=int)
add_absolute_and_relative(parser, 'sg_size_estimate_overhead',
                          'SG size estimates: object overhead:')
Exemple #31
0
#! /usr/bin/env python
"""
========================================================================
Simplifying 29928 unary operators... done! [17292 unary operators]
time to simplify: 0.022623s
========================================================================

=> Here we want to extract 29928 (simplify_before), 17292 (simplify_after) and
0.022623s (simplify_time).
"""

import re

from lab.parser import Parser

print 'Running custom parser'
parser = Parser()
parser.add_pattern(
    'simplify_before',
    r'^Simplifying (\d+) unary operators\.\.\. done! \[\d+ unary operators\]$',
    type=int)
parser.add_pattern(
    'simplify_after',
    r'^Simplifying \d+ unary operators\.\.\. done! \[(\d+) unary operators\]$',
    type=int)
parser.add_pattern('simplify_time', r'^time to simplify: (.+)s$', type=float)
parser.parse()
#!/usr/bin/env python

import hashlib

from lab.parser import Parser


def add_hash_value(content, props):
    props['translator_output_sas_hash'] = hashlib.sha512(content).hexdigest()


parser = Parser()
parser.add_function(add_hash_value, file="output.sas")
parser.parse()
Exemple #33
0
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('hc_iterations',
                   'iPDB: iterations = (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('hc_num_patters',
                   'iPDB: number of patterns = (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('hc_size', 'iPDB: size = (\d+)', required=False, type=int)
parser.add_pattern('hc_num_generated',
                   'iPDB: generated = (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('hc_num_rejected',
                   'iPDB: rejected = (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('hc_max_pdb_size',
                   'iPDB: maximum pdb size = (\d+)',
                   required=False,
                   type=int)
parser.add_pattern('hc_hill_climbing_time',
                   'iPDB: hill climbing time: (.+)s',
                   required=False,
                   type=float)
parser.add_pattern('hc_total_time',
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('initial_h_value', 'initial h value: (\d+)', required=False, type=int)
parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int)
parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float)

def check_ms_constructed(content, props):
    ms_construction_time = props.get('ms_construction_time')
    abstraction_constructed = False
    if ms_construction_time is not None:
        abstraction_constructed = True
    props['ms_abstraction_constructed'] = abstraction_constructed

parser.add_function(check_ms_constructed)

def check_proved_unsolvability(content, props):
    proved_unsolvability = False
    if props['coverage'] == 0:
        for line in content.splitlines():
            if line == 'Completely explored state space -- no solution!':
                proved_unsolvability = True
                break
    props['proved_unsolvability'] = proved_unsolvability

parser.add_function(check_proved_unsolvability)

def check_planner_exit_reason(content, props):
    ms_abstraction_constructed = props.get('ms_abstraction_constructed')
Exemple #35
0
from lab.parser import Parser


def solved(content, props):
    props['solved'] = int('cover' in props)


def error(content, props):
    if props['solved']:
        props['error'] = 'cover-found'
    else:
        props['error'] = 'unsolved'


if __name__ == '__main__':
    parser = Parser()
    parser.add_pattern('node',
                       r'node: (.+)\n',
                       type=str,
                       file='driver.log',
                       required=True)
    parser.add_pattern('solver_exit_code',
                       r'solve exit code: (.+)\n',
                       type=int,
                       file='driver.log')
    parser.add_pattern('cover', r'Cover: set\(\[(.*)\]\)', type=str)
    parser.add_pattern('cover_size', r'Cover size: (\d+)\n', type=int)
    parser.add_pattern('solve_time', r'Solve time: (.+)s', type=float)
    parser.add_function(solved)
    parser.add_function(error)
    parser.parse()
Exemple #36
0
#! /usr/bin/env python

from lab.parser import Parser


def wordcount(content, props):
    props["number_of_files"] = len(content.splitlines())


parser = Parser()
parser.add_function(wordcount)
parser.add_pattern("first_number", "(\d+)")
parser.parse()
Exemple #37
0
def main():
    print("Running singularity parser")
    parser = Parser()
    parser.add_pattern(
        "planner_exit_code",
        r"run-planner exit code: (.+)\n",
        type=int,
        file="driver.log",
        required=True,
    )
    parser.add_pattern("node",
                       r"node: (.+)\n",
                       type=str,
                       file="driver.log",
                       required=True)
    parser.add_pattern(
        "planner_wall_clock_time",
        r"run-planner wall-clock time: (.+)s",
        type=float,
        file="driver.log",
        required=True,
    )
    parser.add_pattern("runtime", r"Singularity runtime: (.+?)s", type=float)
    parser.add_pattern("raw_memory", r"Peak memory: (\d+) KB", type=int)
    parser.add_pattern("cost", r"\nFinal value: (.+)\n", type=int)
    parser.add_function(coverage)
    parser.add_function(unsolvable)
    parser.add_function(error)
    parser.add_function(parse_g_value_over_time)
    parser.parse()
Exemple #38
0
def main():
    parser = Parser()
    parser.add_pattern("raw_memory", r"Peak memory: (.+) KB", type=int),
    parser.add_function(find_all_matches("cost:all", r"Plan cost: (.+)\n", type=float))
    parser.add_function(
        find_all_matches("steps:all", r"Plan length: (.+) step\(s\).\n", type=float)
    )
    parser.add_function(reduce_to_min("cost:all", "cost"))
    parser.add_function(reduce_to_min("steps:all", "steps"))
    parser.add_function(coverage)
    parser.add_function(add_memory)
    parser.parse()
Exemple #39
0
#! /usr/bin/env python

from lab.parser import Parser

parser = Parser()
parser.add_pattern('pi', 'Pi: (.+)', type=float)
parser.parse()