Permalink
Browse files

Db scheduler: Take queue/exchange/rkey options when importing entries

  • Loading branch information...
1 parent 2bfdc62 commit e58df632933b9bd544021d7bab0b8d9cab40990b @ask committed Apr 16, 2012
Showing with 4 additions and 1 deletion.
  1. +0 −1 djcelery/loaders.py
  2. +4 −0 djcelery/schedulers.py
View
@@ -110,7 +110,6 @@ def on_worker_init(self):
self.close_database()
self.close_cache()
- self.import_default_modules()
def import_default_modules(self):
super(DjangoLoader, self).import_default_modules()
@@ -83,6 +83,7 @@ def to_model_schedule(cls, schedule):
@classmethod
def from_entry(cls, name, skip_fields=("relative", "options"), **entry):
+ options = entry.get("options") or {}
fields = dict(entry)
for skip_field in skip_fields:
fields.pop(skip_field, None)
@@ -91,6 +92,9 @@ def from_entry(cls, name, skip_fields=("relative", "options"), **entry):
fields[model_field] = model_schedule
fields["args"] = serialize(fields.get("args") or [])
fields["kwargs"] = serialize(fields.get("kwargs") or {})
+ fields["queue"] = options.get("queue")
+ fields["exchange"] = options.get("exchange")
+ fields["routing_key"] = options.get("routing_key")
return cls(PeriodicTask._default_manager.update_or_create(name=name,
defaults=fields))

0 comments on commit e58df63

Please sign in to comment.