Skip to content
Snippets Groups Projects
gather_results.py 1.01 KiB
Newer Older
  • Learn to ignore specific revisions
  • """
    gather_results: gather OAR results from one dir to one file called gathered_results in the same directory.
    
    The result files should consist of lines and should have "stdout" in their name.
    
    Usage:
        gather_results -i IPATH
    
    Options:
        -h --help                   Show this screen.
        -i --input-dir=<IPATH>      Inut directory wher to find results
    """
    
    
    from os import listdir
    import os
    from os.path import isfile, join
    
        arguments = docopt.docopt(__doc__)
        mypath = os.path.abspath(arguments["--input-dir"])
    
        onlyfiles = [os.path.join(mypath, f) for f in listdir(mypath) if isfile(join(mypath, f))]
        count = 0
        results = []
        for f_name in onlyfiles:
    
                continue
            with open(f_name, "r") as f:
                str_f = f.read().strip()
                results.append(str_f)
    
        with open(os.path.join(mypath, "gathered_results"), 'w') as f_w:
            for s in results:
                f_w.write(s)
                f_w.write("\n")