Refactor module structure
Move mysqltasks to top level to keep the task names when using Python3.
This commit is contained in:
parent
2c0aa2fa92
commit
ca0d8451d0
9 changed files with 42 additions and 27 deletions
|
@ -1,6 +1,8 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
* :support:`-` move mysqltasks to top level to keep the task names when
|
||||
using Python 3
|
||||
* :support:`-` drop old requirements files
|
||||
|
||||
* :release:`0.1.2 <2020-02-29>`
|
||||
|
|
3
gvamysql/gvacommon/.gitignore
vendored
3
gvamysql/gvacommon/.gitignore
vendored
|
@ -1,3 +0,0 @@
|
|||
.*.swp
|
||||
*.pyc
|
||||
.ropeproject/
|
|
@ -1,9 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
class GvaRouter(object):
|
||||
|
||||
def route_for_task(self, task, args=None, kwargs=None):
|
||||
for route in ['ldap', 'file', 'mysql', 'pgsql']:
|
||||
if route in task:
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
"""
|
||||
This module contains :py:mod:`mysqltasks.tasks`.
|
||||
"""
|
||||
|
||||
__version__ = "0.2.0"
|
||||
|
||||
from mysqltasks.celery import app as celery_app
|
||||
|
||||
__all__ = ('celery_app',)
|
||||
|
|
|
@ -9,7 +9,7 @@ from __future__ import absolute_import
|
|||
from celery import Celery
|
||||
|
||||
#: The Celery application
|
||||
app = Celery('gvamysql')
|
||||
app = Celery("mysqltasks")
|
||||
|
||||
app.config_from_object('gvamysql.settings')
|
||||
app.autodiscover_tasks(['mysqltasks'], force=True)
|
||||
app.config_from_object("mysqltasks.settings", namespace="CELERY")
|
||||
app.autodiscover_tasks(["mysqltasks.tasks"], force=True)
|
|
@ -25,23 +25,21 @@ def get_env_setting(setting):
|
|||
|
||||
|
||||
########## CELERY CONFIGURATION
|
||||
CELERY_TIMEZONE = 'Europe/Berlin'
|
||||
CELERY_ENABLE_UTC = True
|
||||
CELERY_RESULT_BACKEND = 'amqp'
|
||||
CELERY_BROKER_URL = get_env_setting("GVAMYSQL_BROKER_URL")
|
||||
CELERY_RESULT_BACKEND = get_env_setting("GVAMYSQL_RESULT_REDIS_URL")
|
||||
CELERY_RESULT_PERSISTENT = True
|
||||
CELERY_TASK_RESULT_EXPIRES = None
|
||||
CELERY_ROUTES = (
|
||||
'gvacommon.celeryrouters.GvaRouter',
|
||||
)
|
||||
CELERY_ACCEPT_CONTENT = ['json']
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
CELERY_RESULT_SERIALIZER = 'json'
|
||||
BROKER_URL = get_env_setting('GVAMYSQL_BROKER_URL')
|
||||
CELERY_ROUTES = ("gvacommon.celeryrouters.GvaRouter",)
|
||||
CELERY_TIMEZONE = "Europe/Berlin"
|
||||
CELERY_ENABLE_UTC = True
|
||||
CELERY_ACCEPT_CONTENT = ["json"]
|
||||
CELERY_TASK_SERIALIZER = "json"
|
||||
CELERY_RESULT_SERIALIZER = "json"
|
||||
########## END CELERY CONFIGURATION
|
||||
|
||||
########## GVAMYSQL CONFIGURATION
|
||||
GVAMYSQL_DBADMIN_HOST = get_env_setting('GVAMYSQL_DBADMIN_HOST')
|
||||
GVAMYSQL_DBADMIN_PORT = int(get_env_setting('GVAMYSQL_DBADMIN_PORT'))
|
||||
GVAMYSQL_DBADMIN_USER = get_env_setting('GVAMYSQL_DBADMIN_USER')
|
||||
GVAMYSQL_DBADMIN_PASSWORD = get_env_setting('GVAMYSQL_DBADMIN_PASSWORD')
|
||||
GVAMYSQL_DBADMIN_HOST = get_env_setting("GVAMYSQL_DBADMIN_HOST")
|
||||
GVAMYSQL_DBADMIN_PORT = int(get_env_setting("GVAMYSQL_DBADMIN_PORT"))
|
||||
GVAMYSQL_DBADMIN_USER = get_env_setting("GVAMYSQL_DBADMIN_USER")
|
||||
GVAMYSQL_DBADMIN_PASSWORD = get_env_setting("GVAMYSQL_DBADMIN_PASSWORD")
|
||||
########## END GVAMYSQL CONFIGURATION
|
|
@ -2,12 +2,10 @@
|
|||
This module defines Celery_ tasks to manage MySQL users and databases.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from celery import shared_task
|
||||
from celery.utils.log import get_task_logger
|
||||
|
||||
from gvamysql import settings
|
||||
from mysqltasks import settings
|
||||
from MySQLdb import connect
|
||||
|
||||
|
||||
|
|
18
gvamysql/setup.cfg
Normal file
18
gvamysql/setup.cfg
Normal file
|
@ -0,0 +1,18 @@
|
|||
[coverage:run]
|
||||
source = gvacommon,mysqltasks
|
||||
branch = True
|
||||
omit = */tests/*.py,*/tests.py
|
||||
relative_files = True
|
||||
|
||||
[coverage:report]
|
||||
show_missing = True
|
||||
|
||||
[coverage:html]
|
||||
directory = ../coverage-report
|
||||
|
||||
[isort]
|
||||
multi_line_output = 3
|
||||
line_length = 88
|
||||
known_third_party = celery,MySQLdb
|
||||
include_trailing_comma = True
|
||||
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
|
Loading…
Reference in a new issue