6 from threading import Thread
18 if phs == 0 or phs == 1:
44 except exceptions.ConfigurationError:
45 if not conf.ignore_misconfig:
46 print("Configuration mismatch. Exiting.")
71 phases = ("Not Initialized", #0
74 "Solution generating", #3
75 "Solution generated", #4
76 "Solution applying", #5
77 "Solution applied", #6
78 "Kernel configuration", #7
79 "Kernel configured", #8
83 "Benchmark successful" #12
88 with open(sf(conf.phase_file)) as f:
89 txtPhase = f.readline().rstrip()
90 if not txtPhase in phases:
92 return phases.index(txtPhase)
93 except FileNotFoundError:
101 with open(sf(conf.phase_file), 'w') as f:
104 def phase_message(phs):
105 "Prints message signaling running phase_"
106 print("-- " + phases[phs])
109 def iteration_reset():
110 with open(sf(conf.iteration_file), 'w') as f:
114 with open(sf(conf.iteration_file), 'r') as f:
115 it = int(f.readline())
117 with open(sf(conf.iteration_file), 'w') as f:
121 class mainThread(Thread):
122 def __init__(self, name):
123 Thread.__init__(self, name=name)
126 if conf.step_by_step:
128 elif conf.single_loop:
129 while not phase_get() == 2:
132 while not phase_get() == 2:
142 def sigterm_handler(_signo, _stack_frame):
147 thr = mainThread("thred")
151 except KeyboardInterrupt:
154 #################################################################################
156 if __name__ == '__main__':
157 signal.signal(signal.SIGTERM, sigterm_handler)