[Yt-svn] commit/yt: MatthewTurk: The increase in heartbeat speed kept the server alive past the Quit timeout.

Bitbucket commits-noreply at bitbucket.org
Thu Apr 14 11:05:16 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/0d75f67fa9c1/
changeset:   r4128:0d75f67fa9c1
branch:      yt
user:        MatthewTurk
date:        2011-04-14 20:05:09
summary:     The increase in heartbeat speed kept the server alive past the Quit timeout.
Also fixed load_script, which had been broken by the new payload / heartbeat
mechanism.
affected #:  5 files (626 bytes)

--- a/yt/gui/reason/bottle_mods.py	Thu Apr 14 11:15:57 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Thu Apr 14 14:05:09 2011 -0400
@@ -50,7 +50,11 @@
     _shared_state = {}
     _hold = False
     payloads = None
+    recorded_payloads = None
     lock = None
+    record = False
+    count = 0
+
 
     def __new__(cls, *p, **k):
         self = object.__new__(cls, *p, **k)
@@ -60,16 +64,25 @@
     def __init__(self):
         if self.payloads is None: self.payloads = []
         if self.lock is None: self.lock = threading.Lock()
+        if self.recorded_payloads is None: self.recorded_payloads = []
 
     def deliver_payloads(self):
         with self.lock:
             if self._hold: return []
             payloads = self.payloads
+            if self.record:
+                self.recorded_payloads += self.payloads
             self.payloads = []
         return payloads
 
     def add_payload(self, to_add):
-        self.payloads.append(to_add)
+        with self.lock:
+            self.payloads.append(to_add)
+            self.count += 1
+
+    def replay_payloads(self):
+        return self.recorded_payloads
+
 
 class YTRocketServer(ServerAdapter):
     server_info = {} # Hack to get back at instance vars


--- a/yt/gui/reason/extdirect_repl.py	Thu Apr 14 11:15:57 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Apr 14 14:05:09 2011 -0400
@@ -169,9 +169,10 @@
 
     def shutdown(self):
         if self.server is None:
-            print "Can't shutdown!"
+            return
         self._heartbeat_timer.cancel()
-        for v in self.server.values(): v.stop()
+        for v in self.server.values():
+            v.stop()
 
     def _help_html(self):
         vals = open(os.path.join(local_dir, "html/help.html")).read()


--- a/yt/gui/reason/html/js/functions.js	Thu Apr 14 11:15:57 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Apr 14 14:05:09 2011 -0400
@@ -42,7 +42,12 @@
             OutputContainer.add(cell);
             OutputContainer.doLayout();
             notebook.doLayout();
-            repl_input.get("input_line").setValue("");
+            if (repl_input.locked == true) {
+                /* Assume only one locking level */
+                repl_input.locked = false;
+            } else {
+                repl_input.get("input_line").setValue("");
+            }
             if (OutputContainer.items.length > 1) {
                 examine = cell;
                 OutputContainer.body.dom.scrollTop = 
@@ -65,6 +70,7 @@
         } else if (payload['type'] == 'cell_contents') {
 	        var input_line = repl_input.get("input_line");
 	        input_line.setValue(payload['value']);
+            repl_input.locked = true;
         } else if (payload['type'] == 'log_entry') {
 	        var record = new logging_store.recordType(
 		        {record: payload['log_entry'] });


--- a/yt/gui/reason/html/js/menu_items.js	Thu Apr 14 11:15:57 2011 -0400
+++ b/yt/gui/reason/html/js/menu_items.js	Thu Apr 14 14:05:09 2011 -0400
@@ -96,6 +96,7 @@
            {xtype: 'menuseparator'},
            {xtype:'menuitem', text: 'Quit',
              handler: function(b,e) {
+                task_runner.stop(heartbeat)
                 yt_rpc.ExtDirectREPL.shutdown({}, function(f,a) { 
                 Ext.Msg.alert("Goodbye!", "Goodbye from Reason!", function() {
                 window.open("http://www.google.com/", "_top");});});


--- a/yt/gui/reason/html/js/reason.js	Thu Apr 14 11:15:57 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Apr 14 14:05:09 2011 -0400
@@ -200,6 +200,7 @@
 
     var heartbeat_request = false;
     var task_runner = new Ext.util.TaskRunner();
+    var heartbeat;
 
 
     Ext.onReady(function(){
@@ -314,7 +315,7 @@
 
     /* Set up the heartbeat */
     var num = 0;
-    var heartbeat = {
+    heartbeat = {
     run:
       function(){ if (heartbeat_request == true) return; 
         yt_rpc.ExtDirectREPL.heartbeat(

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