comparison sat/plugins/plugin_app_manager_docker/__init__.py @ 3998:402d31527af4

plugin app manager: `start` doesn't wait anymore for actual app start: Application may be long to start (e.g. a Docker app may have to download images first, and even without the downloading, the starting could be long), which may lead to UI blocking or bridge time out. To prevent that, `start` is now returning immediately, and 2 new signals are used to indicate when the application is started, of if something wrong happened. `start` now returns initial app data, including exposed data without the computed exposed data. The computed data must be retrieved after the app has been started.
author Goffi <goffi@goffi.org>
date Sat, 04 Mar 2023 18:30:47 +0100
parents be6d91572633
children
comparison
equal deleted inserted replaced
3997:1b7c6ee080b9 3998:402d31527af4
55 self.host = host 55 self.host = host
56 self._am = host.plugins['APP_MANAGER'] 56 self._am = host.plugins['APP_MANAGER']
57 self._am.register(self) 57 self._am.register(self)
58 58
59 async def start(self, app_data: dict) -> None: 59 async def start(self, app_data: dict) -> None:
60 await self._am.startCommon(app_data) 60 await self._am.start_common(app_data)
61 working_dir = app_data['_instance_dir_path'] 61 working_dir = app_data['_instance_dir_path']
62 try: 62 try:
63 override = app_data['override'] 63 override = app_data['override']
64 except KeyError: 64 except KeyError:
65 pass 65 pass
81 self.docker_compose_path, 81 self.docker_compose_path,
82 "down", 82 "down",
83 path=str(working_dir), 83 path=str(working_dir),
84 ) 84 )
85 85
86 async def computeExpose(self, app_data: dict) -> dict: 86 async def compute_expose(self, app_data: dict) -> dict:
87 working_dir = app_data['_instance_dir_path'] 87 working_dir = app_data['_instance_dir_path']
88 expose = app_data['expose'] 88 expose = app_data['expose']
89 ports = expose.get('ports', {}) 89 ports = expose.get('ports', {})
90 for name, port_data in list(ports.items()): 90 for name, port_data in list(ports.items()):
91 try: 91 try: