write results on failures
This commit is contained in:
parent
ace846991e
commit
e77f46914c
1 changed files with 16 additions and 10 deletions
|
@ -42,9 +42,13 @@ class Cmd:
|
|||
self.execution_time = None # type: Optional[datetime.timedelta]
|
||||
|
||||
@property
|
||||
def has_title(self):
|
||||
def has_title(self) -> bool:
|
||||
return self.title is not None
|
||||
|
||||
@property
|
||||
def was_executed(self) -> bool:
|
||||
return self.execution_time is not None
|
||||
|
||||
|
||||
class Remove(Cmd):
|
||||
"""Remove command, sensitive to OS."""
|
||||
|
@ -86,8 +90,10 @@ def run_benchmark(commit: str, name: str, result_file_path: str, workdir: str, p
|
|||
if os.path.exists(workdir):
|
||||
run_cmd(Remove(workdir), cmd_parameters, '.')
|
||||
os.makedirs(workdir)
|
||||
try:
|
||||
for command in COMMANDS:
|
||||
run_cmd(command, cmd_parameters, workdir)
|
||||
finally:
|
||||
write_results(COMMANDS, result_file_path, name)
|
||||
|
||||
|
||||
|
@ -107,7 +113,7 @@ def write_results(commands: List[Cmd], result_file_path : str, name: str):
|
|||
'timestamp': datetime.datetime.now().timestamp(),
|
||||
'OS': platform.platform()
|
||||
}
|
||||
for command in (cmd for cmd in commands if cmd.has_title):
|
||||
for command in (cmd for cmd in commands if (cmd.has_title and cmd.was_executed)):
|
||||
row[command.title] = command.execution_time.total_seconds()
|
||||
writer.writerow(row)
|
||||
print('Benchmark completed.')
|
||||
|
|
Loading…
Reference in a new issue