From: Guillaume Pellerin Date: Mon, 9 Mar 2015 11:03:58 +0000 (+0100) Subject: first gearman test X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=ffdc04cfb4fa2a5c1e41689d5a8095cd3878304a;p=timeside.git first gearman test --- diff --git a/examples/sandbox/settings.py b/examples/sandbox/settings.py index e2d8c70..9a00ba8 100644 --- a/examples/sandbox/settings.py +++ b/examples/sandbox/settings.py @@ -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'] diff --git a/setup.py b/setup.py index 63e2a7b..ebe2fc7 100755 --- a/setup.py +++ b/setup.py @@ -61,6 +61,7 @@ setup( 'south', 'traits', 'networkx', + 'django-gearman', ], platforms=['OS Independent'], license='Gnu Public License V2', diff --git a/timeside/server/models.py b/timeside/server/models.py index 0ba1288..9e95474 100644 --- a/timeside/server/models.py +++ b/timeside/server/models.py @@ -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)