Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Configuration for supervisor will rewrited both after supervisor and …

…relative worker editing
  • Loading branch information...
commit be53c7c020be066bf5bdd64108b0e10ff6092c1b 1 parent 030d201
Alexey Kachayev authored July 31, 2011
8  gearoscope/apps/scoper/models.py
@@ -276,8 +276,9 @@ def rewrite_gearman_configuration(sender, **kwargs):
276 276
     gearman = kwargs['instance']
277 277
     server  = gearman.server.name
278 278
 
279  
-    Rewriter().rebuild('gearman:%s' % server, {'server': server, 'port': port}).save()
  279
+    Rewriter().rebuild('gearman:%s' % server, {'server': server, 'port': gearman.port}).save()
280 280
 
  281
+@receiver(post_save, sender=Worker)
281 282
 @receiver(post_save, sender=Supervisor)
282 283
 def rewrite_supervisor_configuration(sender, **kwargs):
283 284
     '''
@@ -290,12 +291,13 @@ def rewrite_supervisor_configuration(sender, **kwargs):
290 291
     about necessary workers/subworkers, we should also save list of
291 292
     process names (and groups in future)
292 293
     '''
293  
-    supervisor = kwargs['instance']
  294
+    supervisor = kwargs['instance'] if sender == Supervisor else kwargs['instance'].supervisor
294 295
     server = supervisor.server.name
295 296
 
296 297
     # To build map of all necessary worker name,
297 298
     # we should iterate per each worker and join names
298 299
     names = ','.join([worker.name for worker in Worker.objects.filter(supervisor=supervisor)])
299 300
 
300  
-    Rewriter().rebuild('supervisor:%s' % server, {'server': server, 'port': port, 'names': names}).save()
  301
+    Rewriter().rebuild('supervisor:%s' % server,
  302
+                       {'server': server, 'port': supervisor.port, 'names': names}).save()
301 303
 
9  gearoscope/data/sonar.conf
@@ -18,3 +18,12 @@ host = localhost
18 18
 password =
19 19
 user = root
20 20
 
  21
+[gearman:localhost]
  22
+port = 4730
  23
+server = localhost
  24
+
  25
+[supervisor:localhost]
  26
+names = multiple
  27
+port = 8999
  28
+server = localhost
  29
+

0 notes on commit be53c7c

Please sign in to comment.
Something went wrong with that request. Please try again.