diff --git a/BUGS b/BUGS index cfd7923..fc7d0af 100644 --- a/BUGS +++ b/BUGS @@ -1,8 +1,4 @@ Current -- Sometimes a paused worker has the running status (blue), when it should - have the paused status (yellow). -- If a job is paused for longer than the timeout period, sometimes it has - the timed out status when un-paused. - Tmp files are being left behind after shutdown. - All tools in AppImages aren't working correctly. See ./vigil --self_test @@ -256,6 +252,12 @@ Fixed - The brightness of the summary's title slightly changes when focused. <- Went away! - Timeout statuses aren't appearing. Probably related to subprocess.run. +- Sometimes a paused worker has the running status (blue), when it should + have the paused status (yellow). + <- Dropped pause feature. +- If a job is paused for longer than the timeout period, sometimes it has + the timed out status when un-paused. + <- Dropped pause feature. Won't fix diff --git a/eris/__main__.py b/eris/__main__.py index e446868..a0391e0 100755 --- a/eris/__main__.py +++ b/eris/__main__.py @@ -72,7 +72,6 @@ KEYS_DOC = """Keys: *e - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL. *n - Move to the next issue. *N - Move to the next issue of the current tool. - *p - Pause workers. (toggle) *o - Order files by type, or by directory location. (toggle) *r - Refresh the currently selected report. *R - Refresh all reports of the current tool. @@ -489,8 +488,7 @@ class Summary: def clear_running(self): for row in self._column: for result in row: - if result.status in [tools.Status.running, - tools.Status.paused]: + if result.status == tools.Status.running: self.refresh_result(result) def as_html(self): @@ -644,7 +642,6 @@ class Screen: self._is_listing_portrait = True self._is_log_visible = True self._is_help_visible = False - self._is_paused = False self._is_fullscreen = False self._make_widgets() self._key_map = make_key_map(Screen._KEY_DATA) @@ -660,8 +657,7 @@ class Screen: def make_workers(self, worker_count, is_being_tested, compression): workers = [] for index in range(worker_count): - worker_ = worker.Worker(self._is_paused, is_being_tested, - compression) + worker_ = worker.Worker(is_being_tested, compression) workers.append(worker_) future = worker_.job_runner(self, self._summary, self._log, self._summary._jobs_added_event, @@ -672,7 +668,6 @@ class Screen: def stop_workers(self): for worker_ in self.workers: - worker_.pause() worker_.future.cancel() if worker_.result is not None: worker_.result.reset() @@ -823,17 +818,6 @@ class Screen: with self._summary.keep_selection(): self._summary.sort_entries() - def toggle_pause(self): - self._is_paused = not self._is_paused - self._log.log_command("Paused workers." if self._is_paused else - "Running workers…") - if self._is_paused: - for worker_ in self.workers: - worker_.pause() - else: - for worker_ in self.workers: - worker_.continue_() - def quit_(self): os.kill(os.getpid(), signal.SIGINT) @@ -965,7 +949,7 @@ class Screen: "line " + str(y+1)) _STATUS_BAR = highlight_chars( - " *help *quit *t*a*b:focus *turn *log *edit *next *pause *order" + " *help *quit *t*a*b:focus *turn *log *edit *next *order" " *refresh *fullscreen *xdg-open", Log._GREEN_STYLE) @functools.lru_cache() @@ -977,17 +961,14 @@ class Screen: for char in fill3.ScrollBar._PARTIAL_CHARS[1]] @functools.lru_cache(maxsize=2) - def _get_status_bar_appearance(self, width, is_directory_sort, is_paused, + def _get_status_bar_appearance(self, width, is_directory_sort, progress_bar_size): bar_transparency = 0.7 ordering_text = "directory" if is_directory_sort else "type " - paused_indicator = (termstr.TermStr(" paused").fg_color( - termstr.Color.yellow) if is_paused else termstr.TermStr("running"). - fg_color(termstr.Color.blue)) - indicators = " " + paused_indicator + f" • {ordering_text} " - spacing = " " * (width - len(self._STATUS_BAR) - len(indicators)) - bar = (self._STATUS_BAR[:width - len(indicators)] + spacing + - indicators)[:width] + indicator = f"{ordering_text} " + spacing = " " * (width - len(self._STATUS_BAR) - len(indicator)) + bar = (self._STATUS_BAR[:width - len(indicator)] + spacing + + indicator)[:width] fraction, whole = math.modf(progress_bar_size) whole = int(whole) if whole < len(bar) and bar[whole].data == " ": @@ -1006,8 +987,7 @@ class Screen: progress_bar_size = max(0, width * incomplete / self._summary.result_total) return self._get_status_bar_appearance( - width, self._summary.is_directory_sort, self._is_paused, - progress_bar_size) + width, self._summary.is_directory_sort, progress_bar_size) def appearance(self, dimensions): self._fix_listing() @@ -1034,9 +1014,8 @@ class Screen: ({"home", "ctrl a"}, cursor_home), ({"end", "ctrl e"}, cursor_end), ({"n"}, move_to_next_issue), ({"N"}, move_to_next_issue_of_tool), ({"e"}, edit_file), - ({"q"}, quit_), ({"p", " "}, toggle_pause), ({"r"}, refresh), - ({"R"}, refresh_tool), ({"tab"}, toggle_focus), - ({"f"}, toggle_fullscreen), ("x", xdg_open)] + ({"q"}, quit_), ({"r"}, refresh), ({"R"}, refresh_tool), + ({"tab"}, toggle_focus), ({"f"}, toggle_fullscreen), ("x", xdg_open)] def setup_inotify(root_path, loop, on_filesystem_change, exclude_filter): diff --git a/eris/tools.py b/eris/tools.py index 7150fa2..1345be7 100755 --- a/eris/tools.py +++ b/eris/tools.py @@ -52,8 +52,7 @@ class Status(enum.IntEnum): not_applicable = 5 running = 6 pending = 7 - paused = 8 - timed_out = 9 + timed_out = 8 _STATUS_COLORS = {Status.ok: termstr.Color.green, @@ -61,14 +60,12 @@ _STATUS_COLORS = {Status.ok: termstr.Color.green, Status.normal: termstr.Color.grey_200, Status.not_applicable: termstr.Color.grey_100, Status.running: termstr.Color.blue, - Status.paused: termstr.Color.yellow, Status.timed_out: termstr.Color.purple} STATUS_MEANINGS = [ (Status.normal, "Normal"), (Status.ok, "Ok"), (Status.problem, "Problem"), (Status.not_applicable, "Not applicable"), - (Status.running, "Running"), (Status.paused, "Paused"), - (Status.timed_out, "Timed out"), (Status.pending, "Pending"), - (Status.error, "Error") + (Status.running, "Running"), (Status.timed_out, "Timed out"), + (Status.pending, "Pending"), (Status.error, "Error") ] STATUS_TO_TERMSTR = { status: termstr.TermStr(" ", termstr.CharStyle(bg_color=color)) @@ -583,9 +580,6 @@ class Result: path = path_colored(self.path) log.log_message(["Running ", tool_name, " on ", path, "…"]) self.set_status(Status.running) - if runner.is_already_paused: - runner.is_already_paused = False - runner.pause() appearance_changed_event.set() start_time = time.time() new_status = await runner.run_tool(self.path, self.tool) diff --git a/eris/worker.py b/eris/worker.py index 61a6ad8..8d4fdec 100755 --- a/eris/worker.py +++ b/eris/worker.py @@ -17,8 +17,7 @@ class Worker: AUTOSAVE_MESSAGE = "Auto-saving…" unsaved_jobs_total = 0 - def __init__(self, is_already_paused, is_being_tested, compression): - self.is_already_paused = is_already_paused + def __init__(self, is_being_tested, compression): self.is_being_tested = is_being_tested self.compression = compression self.result = None @@ -68,18 +67,6 @@ class Worker: os.kill(os.getpid(), signal.SIGINT) jobs_added_event.clear() - def pause(self): - if self.result is not None and \ - self.result.status == tools.Status.running: - os.killpg(self.child_pgid, signal.SIGSTOP) - self.result.set_status(tools.Status.paused) - - def continue_(self): - if self.result is not None and \ - self.result.status == tools.Status.paused: - self.result.set_status(tools.Status.running) - os.killpg(self.child_pgid, signal.SIGCONT) - def kill(self): if self.child_pgid is not None: os.killpg(self.child_pgid, signal.SIGKILL) diff --git a/tests/golden-files/help b/tests/golden-files/help index f535706..bbb74b8 100644 --- a/tests/golden-files/help +++ b/tests/golden-files/help @@ -19,7 +19,6 @@ │ e - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL. │ │ n - Move to the next issue. │ │ N - Move to the next issue of the current tool. │ -│ p - Pause workers. (toggle) │ │ o - Order files by type, or by directory location. (toggle) │ │ r - Refresh the currently selected report. │ │ R - Refresh all reports of the current tool. │ @@ -32,7 +31,6 @@ │   Problem │ │   Not applicable │ │   Running │ -│   Paused │ │   Timed out │ │ . Pending │ │ E Error │ @@ -56,5 +54,7 @@ │ │ │ │ │ │ +│ │ +│ │ └──────────────────────────────────────────────────────────────────────────────────────────────────┘ - help quit tab:focus turn log edit next pause order refresh fullscreen xdg-open running • directory  \ No newline at end of file + help quit tab:focus turn log edit next order refresh fullscreen xdg-open directory  \ No newline at end of file diff --git a/tests/worker_test.py b/tests/worker_test.py index 0f07a97..9e9e711 100755 --- a/tests/worker_test.py +++ b/tests/worker_test.py @@ -30,7 +30,7 @@ class WorkerTestCase(unittest.TestCase): def test_run_job(self): loop = asyncio.get_event_loop() compression = "none" - worker_ = worker.Worker(False, False, compression) + worker_ = worker.Worker(False, compression) loop.run_until_complete(worker_.create_process()) worker_.process.stdin.write(f"{compression}\n".encode("utf-8")) future = worker_.run_tool("foo", tools.metadata)