-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_completed_simulations.py
50 lines (37 loc) · 1.41 KB
/
check_completed_simulations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import sys
def main():
if len(sys.argv) != 2:
print "Usage: python check_completed_simulations.py foldername"
sys.exit()
path = os.getcwd() + '/' + sys.argv[1] + '/logs/'
import pdb
files = os.listdir(path)
files = [f for f in files if 'achtung' not in f]
sim_done = 0
sim_done_list = []
not_done = []
for fi_ in files:
with open(path + fi_, 'r') as f:
lines = f.readlines()
lastline = '' if not lines else lines[-1]
if 'Simulation Done' in lastline:
sim_done += 1
sim_done_list.append(fi_.replace('.nohup', '.txt'))
else:
not_done.append(fi_.replace('.nohup', '.txt'))
all_configs = []
configs_path = os.getcwd() + '/' + sys.argv[1] + '/configs/'
config_files = os.listdir(configs_path)
uncompleted_configs = set(config_files).difference(set(sim_done_list))
print "Number of Completed Sims: %d" %(sim_done)
print "Number of UnCompleted Sims: (Include Sims with partial nohups (if any)): %d" %(len(uncompleted_configs))
print "Number of UnCompleted Sims with Partial nohups (need to be investigated): %d" % (len(not_done))
print "UnCompleted Configs:"
for conf in uncompleted_configs:
print conf
print "Uncomplted Configs With Partial Nohup:"
for conf in not_done:
print conf
if __name__ == "__main__":
main()