Commit ad3f235b by Tobias Langer

Ignore unimportant errors and move remove errornous files.

parent 45b8c468
...@@ -36,10 +36,7 @@ def create_dir(filename): ...@@ -36,10 +36,7 @@ def create_dir(filename):
try: try:
os.makedirs(filename) os.makedirs(filename)
except FileExistsError: except FileExistsError:
if not query_yes_no('Folder exists, remove?', default='yes'): pass
return False
shutil.rmtree(filename)
os.makedirs(filename)
return True return True
class cd: class cd:
...@@ -73,8 +70,13 @@ def main(): ...@@ -73,8 +70,13 @@ def main():
for experiment in os.listdir(): for experiment in os.listdir():
if experiment == 'results' or not os.path.isdir(experiment): if experiment == 'results' or not os.path.isdir(experiment):
continue 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): with cd(experiment):
try: try:
p = Popen(['./' + experiment], stdout=of) p = Popen(['./' + experiment], stdout=of)
...@@ -84,6 +86,10 @@ def main(): ...@@ -84,6 +86,10 @@ def main():
print('Failed running experiment: {}'.format(experiment), print('Failed running experiment: {}'.format(experiment),
file=sys.stderr) file=sys.stderr)
sys.exit(1) 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): # with cd(experiment):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment