]> git.parisson.com Git - timeside.git/commitdiff
first gearman test
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 9 Mar 2015 11:03:58 +0000 (12:03 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 9 Mar 2015 11:03:58 +0000 (12:03 +0100)
examples/sandbox/settings.py
setup.py
timeside/server/models.py

index e2d8c70c11b7c6a6f40100f7517e7f5f4ae4a81e..9a00ba8a34fd1e06fd5fcc8bedb23666deaeeaf1 100644 (file)
@@ -134,6 +134,7 @@ INSTALLED_APPS = (
     'timeside.server',
     'timeside.player',
     'rest_framework',
+    'django_gearman',
 )
 
 # A sample logging configuration. The only tangible logging
@@ -168,3 +169,5 @@ LOGGING = {
 REST_FRAMEWORK = {
 }
 
+# One or more gearman servers
+GEARMAN_SERVERS = ['127.0.0.1']
index 63e2a7b05bd7d329af4147e5d81fe94474b4b9a3..ebe2fc76b8ceb7b5c7f20e7fbf8ea0424c4cfd01 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -61,6 +61,7 @@ setup(
         'south',
         'traits',
         'networkx',
+        'django-gearman',
         ],
     platforms=['OS Independent'],
     license='Gnu Public License V2',
index 0ba128814ed29d6b88b0a5ecbb8429598124018b..9e9547431c69232ce83ef0cef3c5f670c25b3ba5 100644 (file)
@@ -406,7 +406,11 @@ def set_hash(sender, **kwargs):
 def run(sender, **kwargs):
     instance = kwargs['instance']
     if instance.status == _PENDING:
-        instance.run()
+        from django_gearman import GearmanClient
+        client = GearmanClient()
+        completed_job_request = client.submit_job("timeside.server.task_run", instance.id)
+        print "Result: '%s'" % completed_job_request.result
+        # instance.run()
 
 
 post_save.connect(set_mimetype, sender=Item)