Commit ad3f235b by Tobias Langer

Ignore unimportant errors and move remove errornous files.

parent 45b8c468
......@@ -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):
......
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