Skip to content

Commit

Permalink
Fixed gui module install and readme, cli module install output.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkimoakbioinformatics committed Dec 9, 2023
1 parent f20cda6 commit 7b5c32c
Show file tree
Hide file tree
Showing 9 changed files with 410 additions and 367 deletions.
1 change: 1 addition & 0 deletions oakvar/gui/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def start_system_worker(self):
self.system_worker_state,
self.local_modules_changed,
self.manager,
self.args.get("debug"),
),
)
self.system_worker.start()
Expand Down
19 changes: 18 additions & 1 deletion oakvar/gui/store_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@ def add_routes(self):
self.local_module_logo_exists,
]
)
self.routes.append(["GET", "/store/requiredmodules", self.get_required_modules])

async def get_required_modules(self, request):
from aiohttp.web import json_response
from ..api.module.install_defs import get_modules_to_install

module_name = request.rel_url.query.get("module_name")
if not module_name:
return json_response({})
to_install = get_modules_to_install(
module_names=[module_name]
)
ret = []
for mn, v in to_install.items():
v["module_name"] = mn
ret.append(v)
return json_response(ret)

async def local_module_logo_exists(self, request):
from aiohttp.web import json_response
Expand Down Expand Up @@ -302,7 +319,7 @@ def send_kill_install_signal(self, module_name: Optional[str]):

if not self.system_worker_state or not module_name:
return
if module_name in self.system_worker_state:
if self.system_worker_state[SYSTEM_STATE_INSTALL_KEY].get(module_name):
self.system_worker_state[SYSTEM_STATE_INSTALL_KEY][module_name][
INSTALL_KILL_SIGNAL
] = True
Expand Down
13 changes: 4 additions & 9 deletions oakvar/gui/system_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@ def system_queue_worker(
system_worker_state: Optional[DictProxy],
local_modules_changed,
manager,
debug: bool,
):
from time import sleep
import traceback
from ..lib.module import install_module
from ..lib.system import setup_system
from ..lib.exceptions import ModuleToSkipInstallation

# from .consts import SYSTEM_STATE_SETUP_KEY
# from .consts import SYSTEM_MSG_KEY
from .util import GuiOuter

setup_outer = GuiOuter(kind="setup")
install_outer = GuiOuter(kind="install")
setup_outer = GuiOuter(kind="setup", stdout_mirror=debug)
install_outer = GuiOuter(kind="install", stdout_mirror=debug)
while True:
try:
sleep(1)
Expand All @@ -72,7 +70,6 @@ def system_queue_worker(
system_queue.pop(0)
if work_type == "setup":
args = data.get("args")
# args[SYSTEM_MSG_KEY] = SYSTEM_STATE_SETUP_KEY
try:
setup_system(outer=setup_outer, **args)
except Exception as e:
Expand All @@ -94,20 +91,18 @@ def system_queue_worker(
stage_handler=stage_handler,
overwrite=True,
fresh=True,
system_worker_state=system_worker_state,
outer=install_outer,
)
if system_worker_state:
remove_module_from_system_worker(
system_worker_state, module_name
)
# unqueue(module_name, system_queue)
local_modules_changed.set()
install_outer.write(f"finished:{module_name}::")
except ModuleToSkipInstallation:
# unqueue(module_name, system_queue)
stage_handler.stage_start("skip")
except Exception:
# unqueue(module_name, system_queue)
local_modules_changed.set()
stage_handler.stage_start("error")
exc_str = traceback.format_exc()
Expand Down
Loading

0 comments on commit 7b5c32c

Please sign in to comment.