From 3e64e1c438cd8f46494619d22ed175d3dfad6b62 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 19 Jul 2023 20:10:55 -0700 Subject: [PATCH 01/12] Remove redundant `git` installation in Dockerfile (#77) --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac34f76..7dd1b5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,6 @@ RUN apt update && \ ADD . /neon_enclosure WORKDIR /neon_enclosure -RUN apt install git - RUN pip install wheel && \ pip install .[docker] From 268810ae105b8dfa754cdd5cc861695981aae22f Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Thu, 20 Jul 2023 03:11:17 +0000 Subject: [PATCH 02/12] Increment Version to 1.6.1a1 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 3212800..3cf884b 100644 --- a/version.py +++ b/version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.6.0" +__version__ = "1.6.1a1" From 01cb0a6d466315f235c62c615a2683954f9cf1db Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 2 Aug 2023 16:07:11 -0700 Subject: [PATCH 03/12] Update XDG_CONFIG_HOME default path for k8s compat. (#78) --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 7dd1b5e..81655ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ LABEL vendor=neon.ai \ ENV OVOS_CONFIG_BASE_FOLDER neon ENV OVOS_CONFIG_FILENAME neon.yaml +ENV XDG_CONFIG_HOME /config RUN apt update && \ apt install -y \ From 11e704811ca501f3076243efb017805edd3718ad Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 2 Aug 2023 23:07:29 +0000 Subject: [PATCH 04/12] Increment Version to 1.6.1a2 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 3cf884b..11e14ff 100644 --- a/version.py +++ b/version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.6.1a1" +__version__ = "1.6.1a2" From f474fa9fd82b2ce9dcba7f00c18e43159fbda66a Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:03:11 -0800 Subject: [PATCH 05/12] Improve Service Shutdown (#37) * Log service shutdown for systemd service troubleshooting * Troubleshooting enclosure service shutdown * Troubleshooting enclosure service shutdown * Troubleshooting enclosure service shutdown * Troubleshooting service shutdown * Troubleshooting service shutdown * Update imports * Troubleshooting systemd warnings * More logging to troubleshoot PHAL shutdown * More logging to troubleshoot enclosure service shutdown * Add exception handling to catch errors handling exit signal * Add PIDLock init to enclosure and admin services * Cleanup changes * Apply plugin shutdown to admin service Remove duplicated call to `status.set_stopping` --------- Co-authored-by: Daniel McKnight --- neon_enclosure/__main__.py | 3 ++- neon_enclosure/admin/__main__.py | 3 ++- neon_enclosure/admin/service.py | 15 +++++++++++++++ neon_enclosure/service.py | 25 +++++++++++++++++++++---- requirements/requirements.txt | 2 +- 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/neon_enclosure/__main__.py b/neon_enclosure/__main__.py index 51cdc1b..f0c9bbc 100644 --- a/neon_enclosure/__main__.py +++ b/neon_enclosure/__main__.py @@ -30,7 +30,7 @@ from neon_utils.process_utils import start_malloc, snapshot_malloc, print_malloc from neon_utils.signal_utils import init_signal_bus, init_signal_handlers from ovos_utils.messagebus import get_mycroft_bus -from ovos_utils.process_utils import reset_sigint_handler +from ovos_utils.process_utils import reset_sigint_handler, PIDLock from ovos_utils.log import LOG from ovos_utils import wait_for_exit_signal @@ -50,6 +50,7 @@ def main(*args, **kwargs): init_signal_bus(bus) init_signal_handlers() reset_sigint_handler() + PIDLock('enclosure') service = NeonHardwareAbstractionLayer(*args, **kwargs) service.start() wait_for_exit_signal() diff --git a/neon_enclosure/admin/__main__.py b/neon_enclosure/admin/__main__.py index c2b6505..97ea113 100644 --- a/neon_enclosure/admin/__main__.py +++ b/neon_enclosure/admin/__main__.py @@ -30,7 +30,7 @@ from neon_utils.process_utils import start_malloc, snapshot_malloc, print_malloc from neon_utils.signal_utils import init_signal_bus, init_signal_handlers from ovos_utils.messagebus import get_mycroft_bus -from ovos_utils.process_utils import reset_sigint_handler +from ovos_utils.process_utils import reset_sigint_handler, PIDLock from ovos_utils import wait_for_exit_signal from ovos_utils.log import LOG @@ -50,6 +50,7 @@ def main(*args, **kwargs): init_signal_bus(bus) init_signal_handlers() reset_sigint_handler() + PIDLock('admin') service = NeonAdminHardwareAbstractionLayer(*args, **kwargs) service.start() wait_for_exit_signal() diff --git a/neon_enclosure/admin/service.py b/neon_enclosure/admin/service.py index f5c1256..10db8cd 100644 --- a/neon_enclosure/admin/service.py +++ b/neon_enclosure/admin/service.py @@ -44,3 +44,18 @@ def start(self): AdminPHAL.start(self) LOG.info("Started Admin PHAL") self.started.set() + + def shutdown(self): + try: + AdminPHAL.shutdown(self) + except Exception as e: + LOG.exception(e) + # TODO: Below should be implemented in ovos-PHAL directly + for service, clazz in self.drivers.items(): + try: + if hasattr(clazz, 'shutdown'): + LOG.debug(f"Shutting Down {service}") + clazz.shutdown() + except Exception as e: + LOG.error(f"Error shutting down {service}: {e}") + del clazz diff --git a/neon_enclosure/service.py b/neon_enclosure/service.py index 37a86e3..2b7cb09 100644 --- a/neon_enclosure/service.py +++ b/neon_enclosure/service.py @@ -25,12 +25,12 @@ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from threading import Event +from threading import Event from ovos_PHAL import PHAL from ovos_plugin_manager.phal import find_phal_plugins from time import time -from mycroft_bus_client import Message +from ovos_bus_client.message import Message from ovos_utils.log import LOG @@ -43,7 +43,7 @@ def __init__(self, skill_id="neon.phal", **kwargs): self.config = self.config or dict() # TODO: Fixed in ovos_PHAL 0.0.5a1 def start(self): - LOG.info("Starting PHAL") + LOG.debug("Starting PHAL") if self.config.get('wait_for_gui'): LOG.info("Waiting for GUI Service to start") timeout = time() + 30 @@ -53,7 +53,7 @@ def start(self): LOG.debug('GUI Service is alive') break PHAL.start(self) - LOG.info("Started PHAL") + LOG.info(f"Started PHAL") self.started.set() def load_plugins(self): @@ -75,3 +75,20 @@ def load_plugins(self): except Exception: LOG.exception(f"failed to load PHAL plugin: {name}") continue + + def shutdown(self): + LOG.info("Shutting Down") + try: + PHAL.shutdown(self) + except Exception as e: + LOG.exception(e) + # TODO: Below should be implemented in ovos-PHAL directly + for service, clazz in self.drivers.items(): + try: + if hasattr(clazz, 'shutdown'): + LOG.debug(f"Shutting Down {service}") + clazz.shutdown() + except Exception as e: + LOG.error(f"Error shutting down {service}: {e}") + del clazz + diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 09f7a20..d17aca8 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ -ovos_PHAL~=0.0.4 +ovos-phal~=0.0.4 neon_utils[network]~=1.6 ovos_utils~=0.0.32 click~=8.0 From b28f8ceda834b57b53057a25ec9949d1b6a08b7f Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Thu, 16 Nov 2023 20:03:29 +0000 Subject: [PATCH 06/12] Increment Version to 1.6.1a3 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 11e14ff..b2f2efe 100644 --- a/version.py +++ b/version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.6.1a2" +__version__ = "1.6.1a3" From 08fc2783fada58ed76a7877f62c1b9932433d236 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 22 Nov 2023 09:30:53 -0800 Subject: [PATCH 07/12] Add monitoring plugin to docker dependencies (#79) Co-authored-by: Daniel McKnight --- requirements/docker.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements/docker.txt b/requirements/docker.txt index ffb94d5..7682492 100644 --- a/requirements/docker.txt +++ b/requirements/docker.txt @@ -4,3 +4,4 @@ ovos-phal-plugin-color-scheme-manager~=1.0.0 ovos-phal-plugin-configuration-provider~=1.0.0 ovos-phal-plugin-dashboard~=0.0.1 ovos-phal-plugin-connectivity-events~=0.0.2 +neon-phal-plugin-monitoring>=0.0.1a2 From 51ec1d3e8624914cc0f943c163bbaec754142e47 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 22 Nov 2023 17:31:12 +0000 Subject: [PATCH 08/12] Increment Version to 1.6.1a4 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index b2f2efe..daba4df 100644 --- a/version.py +++ b/version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.6.1a3" +__version__ = "1.6.1a4" From e1a5e66a474d9a8396faaa638d51ffa9064a2d01 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 13 Dec 2023 13:50:59 -0800 Subject: [PATCH 09/12] Update plugins to stable releases (#80) Co-authored-by: Daniel McKnight --- requirements/docker.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/docker.txt b/requirements/docker.txt index 7682492..9db4b1c 100644 --- a/requirements/docker.txt +++ b/requirements/docker.txt @@ -4,4 +4,4 @@ ovos-phal-plugin-color-scheme-manager~=1.0.0 ovos-phal-plugin-configuration-provider~=1.0.0 ovos-phal-plugin-dashboard~=0.0.1 ovos-phal-plugin-connectivity-events~=0.0.2 -neon-phal-plugin-monitoring>=0.0.1a2 +neon-phal-plugin-monitoring~=0.0.1 From c42d1cc2e0cac0463bbc2b9ffa387546f4added9 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Wed, 13 Dec 2023 21:51:15 +0000 Subject: [PATCH 10/12] Increment Version to 1.6.1a5 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index daba4df..88011a8 100644 --- a/version.py +++ b/version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.6.1a4" +__version__ = "1.6.1a5" From ddfce0a0fb35dc7ebb86e65e1dbdaa9d75d046c4 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Sat, 16 Dec 2023 02:18:17 +0000 Subject: [PATCH 11/12] Increment Version to 1.6.1 --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 88011a8..8c8abcc 100644 --- a/version.py +++ b/version.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.6.1a5" +__version__ = "1.6.1" From 1a04ed0924cccd84fa0d2a2071249e94cc24de98 Mon Sep 17 00:00:00 2001 From: NeonDaniel Date: Sat, 16 Dec 2023 02:18:56 +0000 Subject: [PATCH 12/12] Update Changelog --- CHANGELOG.md | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77dbc07..4104641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,44 @@ # Changelog -## [1.5.2a4](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.5.2a4) (2023-07-20) +## [1.6.1a5](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.6.1a5) (2023-12-13) -[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.5.2a3...1.5.2a4) +[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.6.1a4...1.6.1a5) **Merged pull requests:** -- Better handle default init kwargs [\#75](https://github.com/NeonGeckoCom/neon_enclosure/pull/75) ([NeonDaniel](https://github.com/NeonDaniel)) +- Update plugins to stable releases [\#80](https://github.com/NeonGeckoCom/neon_enclosure/pull/80) ([NeonDaniel](https://github.com/NeonDaniel)) -## [1.5.2a3](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.5.2a3) (2023-07-19) +## [1.6.1a4](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.6.1a4) (2023-11-22) -[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.5.2a2...1.5.2a3) +[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.6.1a3...1.6.1a4) **Merged pull requests:** -- Add `skill_id` to services to resolve logged deprecation warnings [\#74](https://github.com/NeonGeckoCom/neon_enclosure/pull/74) ([NeonDaniel](https://github.com/NeonDaniel)) +- Add monitoring plugin to docker dependencies [\#79](https://github.com/NeonGeckoCom/neon_enclosure/pull/79) ([NeonDaniel](https://github.com/NeonDaniel)) -## [1.5.2a2](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.5.2a2) (2023-07-18) +## [1.6.1a3](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.6.1a3) (2023-11-16) -[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.5.2a1...1.5.2a2) +[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.6.1a2...1.6.1a3) **Merged pull requests:** -- Mark old CLI entrypoint as deprecated [\#73](https://github.com/NeonGeckoCom/neon_enclosure/pull/73) ([NeonDaniel](https://github.com/NeonDaniel)) +- Improve Service Shutdown [\#37](https://github.com/NeonGeckoCom/neon_enclosure/pull/37) ([NeonDaniel](https://github.com/NeonDaniel)) -## [1.5.2a1](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.5.2a1) (2023-06-27) +## [1.6.1a2](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.6.1a2) (2023-08-02) -[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.5.1...1.5.2a1) +[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.6.1a1...1.6.1a2) **Merged pull requests:** -- Update Docker to use OVOS\_CONFIG envvars [\#72](https://github.com/NeonGeckoCom/neon_enclosure/pull/72) ([NeonDaniel](https://github.com/NeonDaniel)) +- Kubernetes container compat. [\#78](https://github.com/NeonGeckoCom/neon_enclosure/pull/78) ([NeonDaniel](https://github.com/NeonDaniel)) + +## [1.6.1a1](https://github.com/NeonGeckoCom/neon_enclosure/tree/1.6.1a1) (2023-07-20) + +[Full Changelog](https://github.com/NeonGeckoCom/neon_enclosure/compare/1.6.0...1.6.1a1) + +**Merged pull requests:** + +- Remove redundant `git` installation in Dockerfile [\#77](https://github.com/NeonGeckoCom/neon_enclosure/pull/77) ([NeonDaniel](https://github.com/NeonDaniel))