Anonymous avatar Anonymous committed 7b31ccd

Can't run threaded worker! Sadly, the message listener doesn't work well then,
must run as main process. But doing .apply() should test the registry well

Comments (0)

Files changed (1)


+import sys
 from celerypaste import set_loader
-from threading import Thread
-import sys
 CELERY_CONFIG ={"BROKER_HOST": "localhost",
                 "BROKER_PORT": 5672,
                 "CELERY_BACKEND": "database",
                 "DATABASE_ENGINE": "sqlite3",
                 "DATABASE_NAME": "test.db",
-                }
+                "CELERY_IMPORTS": ("mytasks", )}
-from celery.registry import tasks
 from celery.task import Task
     def run(self, x, y):
         return x+y
-class CeleryWorker(Thread):
-    def run(self):
-        from celery.bin.celeryd import run_worker
-        run_worker(**vars())
 def setup_db():
     from celery.loaders import current_loader
 def test_run():
-    w = CeleryWorker()
-    w.start()
-    t = AddTask()
-    result = t.apply_async(args=[10, 10], countdown=3)
+    result = AddTask.apply(args=[10, 10])
     assert result.get()==20, "didn't get expected result"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.