Skip to content

Instantly share code, notes, and snippets.

@tecoholic
Created November 7, 2017 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tecoholic/805f5b2449b437dffedb4c2fcdf9a4d9 to your computer and use it in GitHub Desktop.
Save tecoholic/805f5b2449b437dffedb4c2fcdf9a4d9 to your computer and use it in GitHub Desktop.
diff --git a/clusterapp.py b/clusterapp.py
index 46d85d1..685b482 100644
--- a/clusterapp.py
+++ b/clusterapp.py
@@ -4,9 +4,6 @@ from clustermgr.application import create_app, init_celery
from clustermgr.extensions import celery
from flask.cli import FlaskGroup
-app = create_app()
-init_celery(app, celery)
-
def create_cluster_app(info):
return create_app()
@@ -17,6 +14,14 @@ def cli():
"""This is a management script for the wiki application"""
pass
+def run_celery():
+ from celery.bin import worker
+ app = create_app()
+ init_celery(app, celery)
+ runner = worker.worker(app=celery)
+ config = {"loglevel": "INFO"}
+ runner.run(**config)
+
if __name__ == "__main__":
cli()
diff --git a/setup.py b/setup.py
index f8d420d..7c94875 100644
--- a/setup.py
+++ b/setup.py
@@ -37,7 +37,8 @@ setup(
"paramiko",
],
entry_points={
- "console_scripts": ["clustermgr-cli=clusterapp:cli"],
+ "console_scripts": ["clustermgr-cli=clusterapp:cli",
+ "clustermgr-celery=clusterapp:run_celery"],
},
scripts=['clusterapp.py'],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment