forked from platypush/platypush
Added StopCommand
and RestartCommand
.
This commit is contained in:
parent
b1f244a812
commit
c89f992867
2 changed files with 27 additions and 0 deletions
2
platypush/commands/_commands/__init__.py
Normal file
2
platypush/commands/_commands/__init__.py
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# flake8: noqa
|
||||||
|
from ._app_ctrl import *
|
25
platypush/commands/_commands/_app_ctrl.py
Normal file
25
platypush/commands/_commands/_app_ctrl.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
from typing_extensions import override
|
||||||
|
|
||||||
|
from platypush.commands import Command
|
||||||
|
|
||||||
|
|
||||||
|
class StopCommand(Command):
|
||||||
|
"""
|
||||||
|
Stop the application.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@override
|
||||||
|
def __call__(self, app, *_, **__):
|
||||||
|
self.logger.info('Received StopApplication command.')
|
||||||
|
app.stop()
|
||||||
|
|
||||||
|
|
||||||
|
class RestartCommand(Command):
|
||||||
|
"""
|
||||||
|
Restart the application.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@override
|
||||||
|
def __call__(self, app, *_, **__):
|
||||||
|
self.logger.info('Received RestartApplication command.')
|
||||||
|
app.restart()
|
Loading…
Reference in a new issue