Skip to content

Commit

Permalink
Deprecate BROKER_ and REDIS_ options now superceded by BROKER_URL and…
Browse files Browse the repository at this point in the history
… URL form of CELERY_RESULT_BACKEND
  • Loading branch information
ask committed Jun 7, 2012
1 parent ced4b54 commit 47ec212
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
66 changes: 35 additions & 31 deletions celery/app/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
DEFAULT_TASK_LOG_FMT = """[%(asctime)s: %(levelname)s/%(processName)s] \
%(task_name)s[%(task_id)s]: %(message)s"""

_BROKER_OLD = {"deprecate_by": "2.5", "remove_by": "3.0", "alt": "BROKER_URL"}
_REDIS_OLD = {"deprecate_by": "2.5", "remove_by": "3.0",
"alt": "URL form of CELERY_RESULT_BACKEND"}


class Option(object):
alt = None
Expand All @@ -60,28 +64,28 @@ def to_python(self, value):
NAMESPACES = {
"BROKER": {
"URL": Option(None, type="string"),
"HOST": Option(None, type="string"),
"PORT": Option(type="int"),
"USER": Option(None, type="string"),
"PASSWORD": Option(None, type="string"),
"VHOST": Option(None, type="string"),
"CONNECTION_TIMEOUT": Option(4, type="float"),
"CONNECTION_RETRY": Option(True, type="bool"),
"CONNECTION_MAX_RETRIES": Option(100, type="int"),
"POOL_LIMIT": Option(10, type="int"),
"INSIST": Option(False, type="bool",
deprecate_by="2.4", remove_by="3.0"),
"USE_SSL": Option(False, type="bool"),
"TRANSPORT": Option(None, type="string"),
"TRANSPORT": Option(type="string"),
"TRANSPORT_OPTIONS": Option({}, type="dict"),
"HOST": Option(type="string", **_BROKER_OLD),
"PORT": Option(type="int", **_BROKER_OLD),
"USER": Option(type="string", **_BROKER_OLD),
"PASSWORD": Option(type="string", **_BROKER_OLD),
"VHOST": Option(type="string", **_BROKER_OLD),
},
"CASSANDRA": {
"COLUMN_FAMILY": Option(None, type="string"),
"COLUMN_FAMILY": Option(type="string"),
"DETAILED_MODE": Option(False, type="bool"),
"KEYSPACE": Option(None, type="string"),
"READ_CONSISTENCY": Option(None, type="string"),
"SERVERS": Option(None, type="list"),
"WRITE_CONSISTENCY": Option(None, type="string"),
"KEYSPACE": Option(type="string"),
"READ_CONSISTENCY": Option(type="string"),
"SERVERS": Option(type="list"),
"WRITE_CONSISTENCY": Option(type="string"),
},
"CELERY": {
"ACKS_LATE": Option(False, type="bool"),
Expand All @@ -90,7 +94,7 @@ def to_python(self, value):
deprecate_by="2.5", remove_by="3.0",
alt="CELERY_TASK_RESULT_EXPIRES"),
"AMQP_TASK_RESULT_CONNECTION_MAX": Option(1, type="int",
remove_by="2.5", alt="BROKER_POOL_LIMIT"),
remove_by="2.5", alt="BROKER_POOL_LIMIT"),
"ANNOTATIONS": Option(type="any"),
"BROADCAST_QUEUE": Option("celeryctl"),
"BROADCAST_EXCHANGE": Option("celeryctl"),
Expand All @@ -112,22 +116,22 @@ def to_python(self, value):
"INCLUDE": Option((), type="tuple"),
"IGNORE_RESULT": Option(False, type="bool"),
"MAX_CACHED_RESULTS": Option(5000, type="int"),
"MESSAGE_COMPRESSION": Option(None, type="string"),
"MONGODB_BACKEND_SETTINGS": Option(None, type="dict"),
"REDIS_HOST": Option(None, type="string"),
"REDIS_PORT": Option(None, type="int"),
"REDIS_DB": Option(None, type="int"),
"REDIS_PASSWORD": Option(None, type="string"),
"REDIS_MAX_CONNECTIONS": Option(None, type="int"),
"RESULT_BACKEND": Option(None, type="string"),
"MESSAGE_COMPRESSION": Option(type="string"),
"MONGODB_BACKEND_SETTINGS": Option(type="dict"),
"REDIS_HOST": Option(type="string", **_REDIS_OLD),
"REDIS_PORT": Option(type="int", **_REDIS_OLD),
"REDIS_DB": Option(type="int", **_REDIS_OLD),
"REDIS_PASSWORD": Option(type="string", **_REDIS_OLD),
"REDIS_MAX_CONNECTIONS": Option(type="int", **_REDIS_OLD),
"RESULT_BACKEND": Option(type="string"),
"RESULT_DB_SHORT_LIVED_SESSIONS": Option(False, type="bool"),
"RESULT_DBURI": Option(),
"RESULT_ENGINE_OPTIONS": Option(None, type="dict"),
"RESULT_ENGINE_OPTIONS": Option(type="dict"),
"RESULT_EXCHANGE": Option("celeryresults"),
"RESULT_EXCHANGE_TYPE": Option("direct"),
"RESULT_SERIALIZER": Option("pickle"),
"RESULT_PERSISTENT": Option(False, type="bool"),
"ROUTES": Option(None, type="any"),
"ROUTES": Option(type="any"),
"SEND_EVENTS": Option(False, type="bool"),
"SEND_TASK_ERROR_EMAILS": Option(False, type="bool"),
"SEND_TASK_SENT_EVENT": Option(False, type="bool"),
Expand All @@ -142,25 +146,25 @@ def to_python(self, value):
"interval_step": 0.2}, type="dict"),
"TASK_RESULT_EXPIRES": Option(timedelta(days=1), type="float"),
"TASK_SERIALIZER": Option("pickle"),
"TIMEZONE": Option(None, type="string"),
"TIMEZONE": Option(type="string"),
"TRACK_STARTED": Option(False, type="bool"),
"REDIRECT_STDOUTS": Option(True, type="bool"),
"REDIRECT_STDOUTS_LEVEL": Option("WARNING"),
"QUEUES": Option(None, type="dict"),
"SECURITY_KEY": Option(None, type="string"),
"SECURITY_CERTIFICATE": Option(None, type="string"),
"SECURITY_CERT_STORE": Option(None, type="string"),
"QUEUES": Option(type="dict"),
"SECURITY_KEY": Option(type="string"),
"SECURITY_CERTIFICATE": Option(type="string"),
"SECURITY_CERT_STORE": Option(type="string"),
},
"CELERYD": {
"AUTOSCALER": Option("celery.worker.autoscale.Autoscaler"),
"AUTORELOADER": Option("celery.worker.autoreload.Autoreloader"),
"BOOT_STEPS": Option((), type="tuple"),
"CONCURRENCY": Option(0, type="int"),
"TIMER": Option(None, type="string"),
"TIMER": Option(type="string"),
"TIMER_PRECISION": Option(1.0, type="float"),
"FORCE_EXECV": Option(True, type="bool"),
"HIJACK_ROOT_LOGGER": Option(True, type="bool"),
"CONSUMER": Option(None, type="string"),
"CONSUMER": Option(type="string"),
"LOG_FORMAT": Option(DEFAULT_PROCESS_LOG_FMT),
"LOG_COLOR": Option(type="bool"),
"LOG_LEVEL": Option("WARN", deprecate_by="2.4", remove_by="3.0",
Expand Down Expand Up @@ -193,8 +197,8 @@ def to_python(self, value):
"EMAIL": {
"HOST": Option("localhost"),
"PORT": Option(25, type="int"),
"HOST_USER": Option(None),
"HOST_PASSWORD": Option(None),
"HOST_USER": Option(),
"HOST_PASSWORD": Option(),
"TIMEOUT": Option(2, type="float"),
"USE_SSL": Option(False, type="bool"),
"USE_TLS": Option(False, type="bool"),
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
except Exception:
sys.stderr.write("Couldn't remove %r: %r\n" % (
task_path, sys.exc_info[1]))
except ImportError:
print("Upgrade: no old version found.")
finally:
sys.path[:] = orig_path
except ImportError:
Expand Down

0 comments on commit 47ec212

Please sign in to comment.