From 9df851bc28c470e475c7b87b6897d45118ca27f7 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 27 Nov 2022 08:40:45 +0100 Subject: [PATCH] API - disable worker entry point --- docsrc/source/installation.rst | 2 +- fittrackee/__main__.py | 8 ++++++++ pyproject.toml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docsrc/source/installation.rst b/docsrc/source/installation.rst index 694fadc0..bf8c3dad 100644 --- a/docsrc/source/installation.rst +++ b/docsrc/source/installation.rst @@ -396,7 +396,7 @@ For instance, copy and update ``.env`` file from ``.env.example`` and source the .. code-block:: bash - $ fittrackee_worker --processes 2 + $ flask worker --processes 2 .. note:: | To start application and workers with **systemd** service, see `Deployment `__ diff --git a/fittrackee/__main__.py b/fittrackee/__main__.py index dc9d6b75..bf0598cf 100644 --- a/fittrackee/__main__.py +++ b/fittrackee/__main__.py @@ -81,6 +81,14 @@ def upgrade_db() -> None: upgrade(directory=BASEDIR + '/migrations') +def worker() -> None: + raise SystemExit( + "Error: this command is disabled, " + "it will be removed in a next version.\n" + "Please use flask-dramatiq CLI instead ('flask worker')." + ) + + def main() -> None: options = {'bind': f'{HOST}:{PORT}', 'workers': WORKERS} StandaloneApplication(app, options).run() diff --git a/pyproject.toml b/pyproject.toml index 6ba0ff34..8154a541 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,7 @@ types-redis = "^4.3" [tool.poetry.scripts] fittrackee = 'fittrackee.__main__:main' -fittrackee_worker = 'flask_dramatiq:worker' +fittrackee_worker = 'fittrackee.__main__:worker' # disabled ftcli = 'fittrackee.cli:cli' fittrackee_set_admin = 'fittrackee.__main__:set_admin' # deprecated fittrackee_upgrade_db = 'fittrackee.__main__:upgrade_db' # deprecated