Commits

Britton Smith committed 610232d

Made some changes to get intermediate payloads, not quite there yet.

Comments (0)

Files changed (4)

scripts/pyro_queue.py

 my_rank = comm.comm.rank
 
 if my_rank == 0:
+    from yt.config import ytcfg;ytcfg["yt","__withinreason"]="True"
     my_q = PyroQueueRoot(comm)
     Pyro4.config.HMAC_KEY = uuid.uuid4().hex
     key_file = 'reason.key'

yt/gui/reason/basic_repl.py

 from cStringIO import StringIO
 
 class ProgrammaticREPL(object):
-    
+    stopped = False
+    debug = False
     def __init__(self, locals=None):
+        self.executed_cell_texts = []
         self.locals = {}
         if locals:
             self.locals.update(locals)

yt/gui/reason/extdirect_repl.py

 class ExecutionThread(threading.Thread):
     def __init__(self, repl):
         self.repl = repl
+        self.payload_handler = PayloadHandler()
         self.queue = Queue.Queue()
         threading.Thread.__init__(self)
         self.daemon = True
             print result
             print "========================================================"
         if not hide:
-            self.repl.payload_handler.add_payload(
+            self.payload_handler.add_payload(
                 {'type': 'cell',
                  'output': result,
                  'input': highlighter(code),
                  'raw_input': code},
                 )
         objs = get_list_of_datasets()
-        self.repl.payload_handler.add_payload(
+        self.payload_handler.add_payload(
             {'type': 'dataobjects',
              'objs': objs})
 
     my_name = "ExtDirectREPL"
     timeout = 660 # a minute longer than the rocket server timeout
     server = None
-    stopped = False
-    debug = False
     _heartbeat_timer = None
 
     def __init__(self, reasonjs_path, locals=None,
         # This has to be routed to the root directory
         self.api_url = "repl"
         BottleDirectRouter.__init__(self)
-        self.executed_cell_texts = []
         self.payload_handler = PayloadHandler()
         if use_pyro:
             self.execution_thread = PyroExecutionThread(self)

yt/gui/reason/pyro_queue.py

 from yt.funcs import *
 
 from yt.gui.reason.basic_repl import ProgrammaticREPL
+from yt.gui.reason.extdirect_repl import ExecutionThread
 from yt.gui.reason.bottle_mods import PayloadHandler
 from .utils import get_list_of_datasets
 
     def __init__(self, comm):
         self.comm = comm
         self.repl = ProgrammaticREPL()
+        self.execution_thread = ExecutionThread(self.repl)
         self.payload_handler = PayloadHandler()
+        self.execution_thread.start()
 
     def execute(self, code):
         mylog.info('Root sending out code.')
         code = self.comm.comm.bcast(code, root=0)
-        value = self.repl.execute(code)
-        datasets = get_list_of_datasets()
-        self.payload_handler.add_payload({'type': 'dataobjects',
-                                          'objs': datasets})
-        return value
+        self.execution_thread.execute_one(code, False)
 
     def deliver(self):
         return self.payload_handler.deliver_payloads()