Commit a4216e44 authored by Lukas Weber's avatar Lukas Weber
Browse files

job status fix

parent 390ffb98
...@@ -16,13 +16,12 @@ class JobProgress: ...@@ -16,13 +16,12 @@ class JobProgress:
def __init__(self, jobfile): def __init__(self, jobfile):
self.jobfile = jobfile self.jobfile = jobfile
with open(jobfile, 'r') as f: with open(jobfile, 'r') as f:
jobfile = yaml.load(f) jobfile = yaml.safe_load(f)
self.tasks = jobfile['tasks'].keys() self.tasks = jobfile['tasks'].keys()
self.restart = False self.restart = False
self.progress = [] self.progress = []
for task in self.tasks: for task in self.tasks:
tp = TaskProgress() tp = TaskProgress()
...@@ -42,18 +41,18 @@ class JobProgress: ...@@ -42,18 +41,18 @@ class JobProgress:
tp.therm_sweeps += f['/thermalization_sweeps'][0] tp.therm_sweeps += f['/thermalization_sweeps'][0]
if sweeps < target_sweeps + target_therm: if tp.sweeps < tp.target_sweeps + tp.target_therm:
self.restart = True self.restart = True
self.progress.append(tp) self.progress.append(tp)
def needs_restart(): def needs_restart(self):
return self.restart return self.restart
def needs_merge(): def needs_merge(self):
result_mtime = 0 result_mtime = 0
try: try:
result_mtime = os.path.getmtime(args.jobfile+'.results.yml') result_mtime = os.path.getmtime(self.jobfile+'.results.yml')
except FileNotFoundError: except FileNotFoundError:
return True return True
...@@ -98,7 +97,7 @@ def ystatus(): ...@@ -98,7 +97,7 @@ def ystatus():
return False return False
for task, tp in zip(job_prog.tasks, job_prog.progress): for task, tp in zip(job_prog.tasks, job_prog.progress):
print('{t}: {tp.run_count} runs, {tp.sweeps}/{tp.target_sweeps} sweeps, {tp.therm_sweeps}/{tp.target_therm} thermalization'.format(t=task,tp=tp)) print('{t}: {tp.num_runs} runs, {tp.sweeps}/{tp.target_sweeps} sweeps, {tp.therm_sweeps}/{tp.target_therm} thermalization'.format(t=task,tp=tp))
except FileNotFoundError as e: except FileNotFoundError as e:
print("Error: jobfile '{}' not found.".format(args.jobfile)) print("Error: jobfile '{}' not found.".format(args.jobfile))
...@@ -11,7 +11,7 @@ args = parser.parse_args() ...@@ -11,7 +11,7 @@ args = parser.parse_args()
with open(args.jobfile, 'r') as f: with open(args.jobfile, 'r') as f:
jobfile = yaml.load(f) jobfile = yaml.safe_load(f)
try: try:
shutil.rmtree('{}.data'.format(args.jobfile)) # adjust this if you adjust the task dir format in load-leveller shutil.rmtree('{}.data'.format(args.jobfile)) # adjust this if you adjust the task dir format in load-leveller
......
...@@ -50,7 +50,7 @@ static double parse_duration(std::string str) { ...@@ -50,7 +50,7 @@ static double parse_duration(std::string str) {
} else { } else {
throw std::runtime_error{"seconds"}; throw std::runtime_error{"seconds"};
} }
} catch(std::exception e) { } catch(std::exception &e) {
throw std::runtime_error{ throw std::runtime_error{
fmt::format("'{}' does not fit time format [[hours:]minutes:]seconds: {}", str, e.what())}; fmt::format("'{}' does not fit time format [[hours:]minutes:]seconds: {}", str, e.what())};
} }
......
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 to comment