From ad3f235b92dcd3df78c727d844c37f7e79ced701 Mon Sep 17 00:00:00 2001 From: Tobias Langer Date: Mon, 14 Nov 2016 18:02:12 +0100 Subject: [PATCH] Ignore unimportant errors and move remove errornous files. --- runner.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/runner.py b/runner.py index f43db91..7671952 100755 --- a/runner.py +++ b/runner.py @@ -36,10 +36,7 @@ def create_dir(filename): try: os.makedirs(filename) except FileExistsError: - if not query_yes_no('Folder exists, remove?', default='yes'): - return False - shutil.rmtree(filename) - os.makedirs(filename) + pass return True class cd: @@ -73,8 +70,13 @@ def main(): for experiment in os.listdir(): if experiment == 'results' or not os.path.isdir(experiment): continue + if experiment.isdigit(): + continue + experiment_file = os.path.join('results', experiment + '.out') + if os.path.exists(experiment_file): + continue - with open(os.path.join('results', experiment + '.out'), 'w') as of: + with open(experiment_file, 'w') as of: with cd(experiment): try: p = Popen(['./' + experiment], stdout=of) @@ -84,6 +86,10 @@ def main(): print('Failed running experiment: {}'.format(experiment), file=sys.stderr) sys.exit(1) + if os.stat(experiment_file).st_size == 0: + print('Removing file after failed experiment.', file=sys.stderr) + os.remove(experiment_file) + shutil.rmtree(experiment) # with cd(experiment): -- libgit2 0.26.0