[RavenclawDev 288] [929] Pythia: 1) Added configuration memory

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Wed Jul 4 16:23:28 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/ravenclaw-developers/attachments/20070704/72b4e2a4/attachment.html
-------------- next part --------------
Modified: Pythia/dist/library.zip
===================================================================
(Binary files differ)

Modified: Pythia/dist/process_monitor.exe
===================================================================
(Binary files differ)

Modified: Pythia/src/basic_process_monitor.py
===================================================================
--- Pythia/src/basic_process_monitor.py	2007-07-04 03:00:24 UTC (rev 928)
+++ Pythia/src/basic_process_monitor.py	2007-07-04 20:23:27 UTC (rev 929)
@@ -15,7 +15,7 @@
     from win_pm_core import _MAYBE_ALIVE, _DEFINITELY_ALIVE, _DEFINITELY_DEAD
     pm_core = win_pm_core
 else:
-    raise "Can't run process monitor on", os.name
+    raise Exception, "Can't run process monitor on", os.name
 
 # This class controls the subprocess.
 
@@ -39,7 +39,8 @@
 # For run_test_suite.py, ProcessContainer needs to be able to 
 # stand alone.
 
-ProcessContainerError = "ProcessContainerError"
+class ProcessContainerError(Exception):
+    pass
 
 class ProcessContainer(pm_core.ProcessContainer):
     config_table = [("PROCESS_TITLE:", "-T", 1, "AddTitle", 0),
@@ -401,7 +402,8 @@
 
 import getopt
 
-ConfigurationError = "ConfigurationError"
+class ConfigurationError(Exception):
+    pass
 
 # INCLUDE: is also an option.
 
@@ -629,7 +631,12 @@
 	    if len(args) == 2:
 		self.config_choice = args[1]
 	    self.file = args[0]
-            return self._DigestConfigurationFile(self.file), 0        
+            self.userfile = self.file + ".user"
+            try:
+                user_directives = self._DigestConfigurationFile(self.userfile)
+            except ConfigurationError:
+                user_directives = []
+            return user_directives + self._DigestConfigurationFile(self.file), 0        
 	else:
 	    raise ConfigurationError, "neither args nor configuration file"
         
@@ -638,6 +645,7 @@
             fp = open(test_file, "r")
         except:
             raise ConfigurationError, "couldn't find configuration file "+ test_file
+        
         lines = fp.readlines()
         fp.close()
         directives = []

Modified: Pythia/src/process_monitor.py
===================================================================
--- Pythia/src/process_monitor.py	2007-07-04 03:00:24 UTC (rev 928)
+++ Pythia/src/process_monitor.py	2007-07-04 20:23:27 UTC (rev 929)
@@ -393,6 +393,13 @@
         self.UseProcessSet(process_set)
         self.calls = Queue.Queue(10)
 
+    def RecordConfiguration(self, userfile, config):
+        if userfile == None:
+            return
+        f = open(userfile, "w")
+        for k, v in config.iteritems():
+            f.write("%s: %s\n" % (k, v))
+
     def QDynamicCallback(self, directives):
         self.calls.put(directives)
 
@@ -531,6 +538,9 @@
     def UseCompressedConfig(self, ncols, force = 0):
 	if self.compressed and (ncols == self.numcols) and (not force):
 	    return
+        
+        self.RecordConfiguration(self.process_env.userfile, {'NUM_DIVISIONS': ncols, 'COMPRESSED': ''})
+        
 	if (not self.compressed):
 	    if not force: self.UnuseColumnConfig()
 	    self.compressed = 1
@@ -672,6 +682,9 @@
     def UseColumnConfig(self, ncols, force = 0):
 	if self.compressed == 0 and ncols == self.numcols and (not force):
 	    return
+        
+        self.RecordConfiguration(self.process_env.userfile, {'NUM_DIVISIONS': ncols})
+
 	# Make it uncompressed	
 	if self.compressed:
 	    if not force: self.UnuseCompressedConfig()

Modified: Pythia/src/win_pm_core.py
===================================================================
--- Pythia/src/win_pm_core.py	2007-07-04 03:00:24 UTC (rev 928)
+++ Pythia/src/win_pm_core.py	2007-07-04 20:23:27 UTC (rev 929)
@@ -29,7 +29,7 @@
     PROCESS_RUNNER = 'cmd.exe /c'
 else:
     PROCESS_RUNNER = '<name of program based on MS conspawn.exe>'
-    raise "Unsupported before Windows NT"
+    raise Exception, "Unsupported before Windows NT"
 
 ###########################################################
 #


More information about the Ravenclaw-developers mailing list