Browse Source

Delete information of removed users

Yentl Van Tendeloo 8 years ago
parent
commit
cad84cb40f
1 changed files with 17 additions and 15 deletions
  1. 17 15
      kernel/modelverse_kernel/main.py

+ 17 - 15
kernel/modelverse_kernel/main.py

@@ -24,6 +24,7 @@ class ModelverseKernel(object):
     def execute_yields(self, username, operation, params, reply):
         try:
             self.success = True
+            self.username = username
             if username not in self.generators:
                 self.generators[username] = {}
             if operation not in self.generators[username]:
@@ -50,37 +51,37 @@ class ModelverseKernel(object):
             yield None
         else:
             user_frame, =   yield [("RD", [user_root, "frame"])]
-            inst, phase =   yield [("RD", [user_frame, "IP"]),
+            self.inst, phase =   yield [("RD", [user_frame, "IP"]),
                                    ("RD", [user_frame, "phase"]),
                                   ]
-            self.new_debug, phase_v, inst_v = \
-                            yield [("RD", [inst, "__debug"]),
+            self.new_debug, self.phase_v, inst_v = \
+                            yield [("RD", [self.inst, "__debug"]),
                                    ("RV", [phase]),
-                                   ("RV", [inst]),
+                                   ("RV", [self.inst]),
                                   ]
             if self.new_debug is not None:
                 self.debug_info[username], = yield [("RV", [self.new_debug])]
 
-            if phase_v == "finish":
+            if self.phase_v == "finish":
                 gen = self.helper_init(user_root)
-            elif inst is None:
+            elif self.inst is None:
                 raise Exception("Instruction pointer could not be found!")
-            elif isinstance(phase_v, string_types):
-                if phase_v == "init" and inst in self.compiled:
-                    #print("%-30s(%s)" % ("COMPILED " + str(self.compiled[inst]), phase_v))
-                    gen = self.execute_primitive(user_root, inst, username)
+            elif isinstance(self.phase_v, string_types):
+                if self.phase_v == "init" and self.inst in self.compiled:
+                    #print("%-30s(%s)" % ("COMPILED " + str(self.compiled[self.inst]), self.phase_v))
+                    gen = self.execute_primitive(user_root, self.inst, username)
                 elif inst_v is None:
-                    raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[username], inst_v, phase_v))
+                    raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[username], inst_v, self.phase_v))
                 else:
-                    #print("%-30s(%s) -- %s" % (inst_v["value"], phase_v, username))
-                    gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
+                    #print("%-30s(%s) -- %s" % (inst_v["value"], self.phase_v, username))
+                    gen = getattr(self, "%s_%s" % (inst_v["value"], self.phase_v))(user_root)
             elif inst_v is None:
-                raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[username], inst_v, phase_v))
+                raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[username], inst_v, self.phase_v))
             elif inst_v["value"] == "call":
                 #print("%-30s(%s)" % ("call", "param"))
                 gen = self.call_param(user_root)
             else:
-                raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[username], inst_v, phase_v))
+                raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[username], inst_v, self.phase_v))
 
             try:
                 inp = None
@@ -532,6 +533,7 @@ class ModelverseKernel(object):
             prev_frame, =   yield [("RD", [user_frame, "prev"])]
             if prev_frame is None:
                 _, =            yield [("DN", [user_root])]
+                del self.debug_info[self.username]
             else:
                 _, _ =          yield [("CD", [user_root, "frame", prev_frame]),
                                        ("DN", [user_frame]),