setproctitle

This commit is contained in:
Devaev Maxim 2018-08-20 05:27:19 +03:00
parent 3e3fec4d0c
commit 0d19451bbe
5 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,7 @@ depends=(
"python-pyudev" "python-pyudev"
"python-raspberry-gpio" "python-raspberry-gpio"
"python-pyserial" "python-pyserial"
"python-setproctitle"
) )
makedepends=("python-setuptools") makedepends=("python-setuptools")
source=("$url/archive/v$pkgver.tar.gz") source=("$url/archive/v$pkgver.tar.gz")

View File

@ -12,6 +12,7 @@ from typing import NamedTuple
import yaml import yaml
import serial import serial
import setproctitle
from .logging import get_logger from .logging import get_logger
@ -130,6 +131,7 @@ class Hid(multiprocessing.Process):
get_logger().exception("Can't execute emergency clear HID events") get_logger().exception("Can't execute emergency clear HID events")
def run(self) -> None: # pylint: disable=too-many-branches def run(self) -> None: # pylint: disable=too-many-branches
setproctitle.setproctitle("[hid] " + setproctitle.getproctitle())
try: try:
with serial.Serial(self.__device_path, self.__speed) as tty: with serial.Serial(self.__device_path, self.__speed) as tty:
hid_ready = False hid_ready = False

View File

@ -13,6 +13,7 @@ from typing import Callable
from typing import Optional from typing import Optional
import aiohttp.web import aiohttp.web
import setproctitle
from .aioregion import RegionIsBusyError from .aioregion import RegionIsBusyError
@ -131,6 +132,8 @@ class Server: # pylint: disable=too-many-instance-attributes
def run(self, host: str, port: int) -> None: def run(self, host: str, port: int) -> None:
self.__hid.start() self.__hid.start()
setproctitle.setproctitle("[main] " + setproctitle.getproctitle())
app = aiohttp.web.Application(loop=self.__loop) app = aiohttp.web.Application(loop=self.__loop)
app.router.add_get("/info", self.__info_handler) app.router.add_get("/info", self.__info_handler)

View File

@ -4,3 +4,4 @@ aiofiles
pyudev pyudev
pyyaml pyyaml
pyserial pyserial
setproctitle

View File

@ -4,5 +4,6 @@ aiofiles
pyudev pyudev
pyyaml pyyaml
pyserial pyserial
setproctitle
bumpversion bumpversion
tox tox