Remove pause feature.
- Wasn't being used very much. - The background workers should only be using idle cpu, so shouldn't have any outward effect. - Could also use less workers if necessary.
This commit is contained in:
parent
3ec3098e2f
commit
048413f09b
6 changed files with 25 additions and 63 deletions
10
BUGS
10
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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
│ [m[38;2;0;255;0m[48;2;0;0;0me[m[38;2;255;255;255m[48;2;0;0;0m - Edit the current file with an editor defined by -e, $EDITOR or $VISUAL. │
|
||||
│ [m[38;2;0;255;0m[48;2;0;0;0mn[m[38;2;255;255;255m[48;2;0;0;0m - Move to the next issue. │
|
||||
│ [m[38;2;0;255;0m[48;2;0;0;0mN[m[38;2;255;255;255m[48;2;0;0;0m - Move to the next issue of the current tool. │
|
||||
│ [m[38;2;0;255;0m[48;2;0;0;0mp[m[38;2;255;255;255m[48;2;0;0;0m - Pause workers. (toggle) │
|
||||
│ [m[38;2;0;255;0m[48;2;0;0;0mo[m[38;2;255;255;255m[48;2;0;0;0m - Order files by type, or by directory location. (toggle) │
|
||||
│ [m[38;2;0;255;0m[48;2;0;0;0mr[m[38;2;255;255;255m[48;2;0;0;0m - Refresh the currently selected report. │
|
||||
│ [m[38;2;0;255;0m[48;2;0;0;0mR[m[38;2;255;255;255m[48;2;0;0;0m - Refresh all reports of the current tool. │
|
||||
|
|
@ -32,7 +31,6 @@
|
|||
│ [m[38;2;255;255;255m[48;2;196;2;51m [m[38;2;255;255;255m[48;2;0;0;0m Problem │
|
||||
│ [m[38;2;255;255;255m[48;2;100;100;100m [m[38;2;255;255;255m[48;2;0;0;0m Not applicable │
|
||||
│ [m[38;2;255;255;255m[48;2;0;135;189m [m[38;2;255;255;255m[48;2;0;0;0m Running │
|
||||
│ [m[38;2;255;255;255m[48;2;255;211;0m [m[38;2;255;255;255m[48;2;0;0;0m Paused │
|
||||
│ [m[38;2;255;255;255m[48;2;200;0;200m [m[38;2;255;255;255m[48;2;0;0;0m Timed out │
|
||||
│ . Pending │
|
||||
│ [m[38;2;255;255;255m[48;2;196;2;51mE[m[38;2;255;255;255m[48;2;0;0;0m Error │
|
||||
|
|
@ -56,5 +54,7 @@
|
|||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
│ │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
[m[38;2;255;255;255m[48;2;76;76;76m [m[38;2;76;255;76m[48;2;76;76;76mh[m[38;2;255;255;255m[48;2;76;76;76melp [m[38;2;76;255;76m[48;2;76;76;76mq[m[38;2;255;255;255m[48;2;76;76;76muit [m[38;2;76;255;76m[48;2;76;76;76mtab[m[38;2;255;255;255m[48;2;76;76;76m:focus [m[38;2;76;255;76m[48;2;76;76;76mt[m[38;2;255;255;255m[48;2;76;76;76murn [m[38;2;76;255;76m[48;2;76;76;76ml[m[38;2;255;255;255m[48;2;76;76;76mog [m[38;2;76;255;76m[48;2;76;76;76me[m[38;2;255;255;255m[48;2;76;76;76mdit [m[38;2;76;255;76m[48;2;76;76;76mn[m[38;2;255;255;255m[48;2;76;76;76mext [m[38;2;76;255;76m[48;2;76;76;76mp[m[38;2;255;255;255m[48;2;76;76;76mause [m[38;2;76;255;76m[48;2;76;76;76mo[m[38;2;255;255;255m[48;2;76;76;76mrder [m[38;2;76;255;76m[48;2;76;76;76mr[m[38;2;255;255;255m[48;2;76;76;76mefresh [m[38;2;76;255;76m[48;2;76;76;76mf[m[38;2;255;255;255m[48;2;76;76;76mullscreen [m[38;2;76;255;76m[48;2;76;76;76mx[m[38;2;255;255;255m[48;2;76;76;76mdg-open [m[38;2;76;171;208m[48;2;76;76;76mrunning[m[38;2;255;255;255m[48;2;76;76;76m • directory [m
|
||||
[m[38;2;255;255;255m[48;2;76;76;76m [m[38;2;76;255;76m[48;2;76;76;76mh[m[38;2;255;255;255m[48;2;76;76;76melp [m[38;2;76;255;76m[48;2;76;76;76mq[m[38;2;255;255;255m[48;2;76;76;76muit [m[38;2;76;255;76m[48;2;76;76;76mtab[m[38;2;255;255;255m[48;2;76;76;76m:focus [m[38;2;76;255;76m[48;2;76;76;76mt[m[38;2;255;255;255m[48;2;76;76;76murn [m[38;2;76;255;76m[48;2;76;76;76ml[m[38;2;255;255;255m[48;2;76;76;76mog [m[38;2;76;255;76m[48;2;76;76;76me[m[38;2;255;255;255m[48;2;76;76;76mdit [m[38;2;76;255;76m[48;2;76;76;76mn[m[38;2;255;255;255m[48;2;76;76;76mext [m[38;2;76;255;76m[48;2;76;76;76mo[m[38;2;255;255;255m[48;2;76;76;76mrder [m[38;2;76;255;76m[48;2;76;76;76mr[m[38;2;255;255;255m[48;2;76;76;76mefresh [m[38;2;76;255;76m[48;2;76;76;76mf[m[38;2;255;255;255m[48;2;76;76;76mullscreen [m[38;2;76;255;76m[48;2;76;76;76mx[m[38;2;255;255;255m[48;2;76;76;76mdg-open directory [m
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue