[Yt-svn] commit/yt: MatthewTurk: More debugging statements for payload delivery and heartbeat.

Bitbucket commits-noreply at bitbucket.org
Fri Apr 22 12:51:05 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/35409e1c2582/
changeset:   r4187:35409e1c2582
branch:      yt
user:        MatthewTurk
date:        2011-04-22 21:49:43
summary:     More debugging statements for payload delivery and heartbeat.
affected #:  3 files (563 bytes)

--- a/yt/gui/reason/bottle_mods.py	Fri Apr 22 15:18:22 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Fri Apr 22 15:49:43 2011 -0400
@@ -32,11 +32,15 @@
 import logging, threading
 from yt.utilities.logger import ytLogger as mylog
 from yt.funcs import *
+import sys
 
 route_functions = {}
 route_watchers = []
 payloads = []
 
+orig_stdout = sys.stdout
+orig_stderr = sys.stderr
+
 def preroute(future_route, *args, **kwargs):
     def router(func):
         route_functions[future_route] = (args, kwargs, func)
@@ -55,6 +59,7 @@
     record = False
     event = None
     count = 0
+    debug = False
 
 
     def __new__(cls, *p, **k):
@@ -74,6 +79,10 @@
             payloads = self.payloads
             if self.record:
                 self.recorded_payloads += self.payloads
+            if self.debug:
+                orig_stderr.write("**** Delivering %s payloads\n" % (len(payloads)))
+                for p in payloads:
+                    orig_stderr.write("****    %s\n" % p['type'])
             self.payloads = []
             self.event.clear()
         return payloads
@@ -83,6 +92,8 @@
             self.payloads.append(to_add)
             self.count += 1
             self.event.set()
+            if self.debug:
+                orig_stderr.write("**** Adding payload of type %s\n" % (to_add['type']))
 
     def replay_payloads(self):
         return self.recorded_payloads


--- a/yt/gui/reason/extdirect_repl.py	Fri Apr 22 15:18:22 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Fri Apr 22 15:49:43 2011 -0400
@@ -155,11 +155,13 @@
 
     def heartbeat(self):
         self.last_heartbeat = time.time()
+        if self.debug: print "### Heartbeat ... started"
         for i in range(30): # The total time to wait
             # Check for stop
             if self.stopped: return {'type':'shutdown'}# No race condition
             if self.payload_handler.event.wait(1): # One second timeout
                 return self.payload_handler.deliver_payloads()
+        if self.debug: print "### Heartbeat ... finished"
         return []
 
     def _check_heartbeat(self):


--- a/yt/utilities/command_line.py	Fri Apr 22 15:18:22 2011 -0400
+++ b/yt/utilities/command_line.py	Fri Apr 22 15:49:43 2011 -0400
@@ -951,9 +951,9 @@
         from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
         import yt.gui.reason.bottle as bottle
         from yt.gui.reason.extdirect_repl import ExtDirectREPL
-        from yt.gui.reason.bottle_mods import uuid_serve_functions
+        from yt.gui.reason.bottle_mods import uuid_serve_functions, PayloadHandler
         hr = ExtDirectREPL(base_extjs_path)
-        hr.debug = opts.debug
+        hr.debug = PayloadHandler.debug = opts.debug
         if opts.find:
             # We just have to find them and store references to them.
             command_line = ["pfs = []"]

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list