Removed psutil as a required pip dependency.

Moved to optional dependencies for `system` plugin.

It requires gcc, linux-headers and python-dev to be installed on the
system.

The `python-psutil` system package however will still be installed when
Platypush is installed through a package manager.
This commit is contained in:
Fabio Manganiello 2024-07-27 14:02:53 +02:00
parent f809ce0cb0
commit 92fe119cff
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
3 changed files with 19 additions and 9 deletions

View file

@ -10,8 +10,6 @@ from multiprocessing import Process
from time import time from time import time
from typing import Mapping, Optional from typing import Mapping, Optional
import psutil
from tornado.httpserver import HTTPServer from tornado.httpserver import HTTPServer
from tornado.netutil import bind_sockets, bind_unix_socket from tornado.netutil import bind_sockets, bind_unix_socket
from tornado.process import cpu_count, fork_processes from tornado.process import cpu_count, fork_processes
@ -421,6 +419,14 @@ class HttpBackend(Backend):
workers when the server terminates: workers when the server terminates:
https://github.com/tornadoweb/tornado/issues/1912. https://github.com/tornadoweb/tornado/issues/1912.
""" """
try:
import psutil
except ImportError:
self.logger.warning(
'Could not import psutil, hanging worker processes might remain active'
)
return
parent_pid = ( parent_pid = (
self._server_proc.pid self._server_proc.pid
if self._server_proc and self._server_proc.pid if self._server_proc and self._server_proc.pid

View file

@ -3,19 +3,24 @@
"events": {}, "events": {},
"install": { "install": {
"apk": [ "apk": [
"py3-py-cpuinfo" "py3-py-cpuinfo",
"py3-psutil"
], ],
"apt": [ "apt": [
"python3-cpuinfo" "python3-cpuinfo",
"python3-psutil"
], ],
"dnf": [ "dnf": [
"python-cpuinfo" "python-cpuinfo",
"python-psutil"
], ],
"pacman": [ "pacman": [
"python-py-cpuinfo" "python-py-cpuinfo",
"python-psutil"
], ],
"pip": [ "pip": [
"py-cpuinfo" "py-cpuinfo",
"psutil"
] ]
}, },
"package": "platypush.plugins.system", "package": "platypush.plugins.system",

View file

@ -8,7 +8,6 @@ docutils
flask flask
marshmallow marshmallow
marshmallow_dataclass marshmallow_dataclass
psutil
python-dateutil python-dateutil
python-magic python-magic
pyyaml pyyaml