Coding style.
This commit is contained in:
parent
9c9a0b5e5f
commit
aec31c199e
2 changed files with 19 additions and 12 deletions
|
|
@ -467,8 +467,7 @@ class Summary:
|
|||
return
|
||||
|
||||
def refresh_result(self, result):
|
||||
if result.status not in {tools.Status.running, tools.Status.paused,
|
||||
tools.Status.pending}:
|
||||
if result.is_completed:
|
||||
result.reset()
|
||||
self.closest_placeholder_generator = None
|
||||
self._jobs_added_event.set()
|
||||
|
|
@ -480,6 +479,13 @@ class Summary:
|
|||
if result.tool == tool:
|
||||
self.refresh_result(result)
|
||||
|
||||
def clear_running(self):
|
||||
for row in self._column:
|
||||
for result in row:
|
||||
if result.status in [tools.Status.running,
|
||||
tools.Status.paused]:
|
||||
self.refresh_result(result)
|
||||
|
||||
def as_html(self):
|
||||
html_parts = []
|
||||
styles = set()
|
||||
|
|
@ -1030,6 +1036,7 @@ def load_state(pickle_path, jobs_added_event, appearance_changed_event,
|
|||
summary = screen._summary
|
||||
summary._jobs_added_event = jobs_added_event
|
||||
summary._root_path = root_path
|
||||
summary.clear_running()
|
||||
log = screen._log
|
||||
log._appearance_changed_event = appearance_changed_event
|
||||
return summary, screen, log, is_first_run
|
||||
|
|
|
|||
|
|
@ -524,12 +524,9 @@ for tool_name, tool_toml in tools_toml.items():
|
|||
#############################
|
||||
|
||||
|
||||
LOG_PATH = os.path.join(os.getcwd(), "eris.log")
|
||||
|
||||
|
||||
def log_error(message=None):
|
||||
message = traceback.format_exc() if message is None else message + "\n"
|
||||
with open(LOG_PATH, "a") as log_file:
|
||||
with open("/tmp/eris.log", "a") as log_file:
|
||||
log_file.write(message)
|
||||
|
||||
|
||||
|
|
@ -578,20 +575,22 @@ def status_to_str(status):
|
|||
|
||||
class Result:
|
||||
|
||||
COMPLETED_STATUSES = {
|
||||
Status.ok, Status.problem, Status.normal, Status.error,
|
||||
Status.not_applicable, Status.timed_out}
|
||||
|
||||
def __init__(self, path, tool):
|
||||
self.path = path
|
||||
self.tool = tool
|
||||
self.pickle_path = os.path.join(CACHE_PATH, path + "-" + tool.__name__)
|
||||
self.scroll_position = (0, 0)
|
||||
self.is_completed = False
|
||||
self.is_placeholder = True
|
||||
self.status = Status.pending
|
||||
|
||||
@property
|
||||
@lru_cache_with_eviction(maxsize=50)
|
||||
def result(self):
|
||||
unknown_label = fill3.Text("?")
|
||||
if self.is_placeholder:
|
||||
if self.status == Status.pending:
|
||||
return unknown_label
|
||||
try:
|
||||
with gzip.open(self.pickle_path, "rb") as pickle_file:
|
||||
|
|
@ -609,8 +608,11 @@ class Result:
|
|||
self.status = status
|
||||
self.entry.appearance_cache = None
|
||||
|
||||
@property
|
||||
def is_completed(self):
|
||||
return self.status in Result.COMPLETED_STATUSES
|
||||
|
||||
async def run(self, log, appearance_changed_event, runner):
|
||||
self.is_placeholder = False
|
||||
tool_name = tool_name_colored(self.tool, self.path)
|
||||
path = path_colored(self.path)
|
||||
log.log_message(["Running ", tool_name, " on ", path, "..."])
|
||||
|
|
@ -625,14 +627,12 @@ class Result:
|
|||
end_time = time.time()
|
||||
self.set_status(new_status)
|
||||
appearance_changed_event.set()
|
||||
self.is_completed = True
|
||||
log.log_message(
|
||||
["Finished running ", tool_name, " on ", path, ". ",
|
||||
status_to_str(new_status),
|
||||
f" {round(end_time - start_time, 2)} secs"])
|
||||
|
||||
def reset(self):
|
||||
self.is_placeholder = True
|
||||
self.set_status(Status.pending)
|
||||
|
||||
def appearance_min(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue