[#272] Support for external stop/restart control on the application #273

Merged
blacklight merged 18 commits from 272/external-proc-controller into master 2023-08-15 21:34:44 +02:00
3 changed files with 13 additions and 3 deletions
Showing only changes of commit dc1a152433 - Show all commits

View File

@ -5,12 +5,13 @@ Platypush
.. license: MIT
"""
from .app import Application, main
from .app import Application
from .config import Config
from .context import get_backend, get_bus, get_plugin
from .message.event import Event
from .message.request import Request
from .message.response import Response
from .runner import main
__author__ = 'Fabio Manganiello <fabio@manganiello.tech>'

View File

@ -2,6 +2,7 @@ import argparse
from typing import Sequence
from platypush.bus.redis import RedisBus
from platypush.utils import get_default_pid_file
def parse_cmdline(args: Sequence[str]) -> argparse.Namespace:
@ -61,10 +62,10 @@ def parse_cmdline(args: Sequence[str]) -> argparse.Namespace:
'-P',
dest='pidfile',
required=False,
default=None,
default=get_default_pid_file(),
help="File where platypush will "
+ "store its PID, useful if you're planning to "
+ "integrate it in a service",
+ f"integrate it in a service (default: {get_default_pid_file()})",
)
parser.add_argument(

View File

@ -14,6 +14,7 @@ import socket
import ssl
import urllib.request
from threading import Lock as TLock
from tempfile import gettempdir
from typing import Generator, Optional, Tuple, Union
from dateutil import parser, tz
@ -625,4 +626,11 @@ def get_lock(
lock.release()
def get_default_pid_file() -> str:
"""
Get the default PID file path.
"""
return os.path.join(gettempdir(), 'platypush.pid')
# vim:sw=4:ts=4:et: