6.13.7. The process frame

The _process frame_ contains data configuring a particular processing run. That data is gleaned from command line switches, the environment, defaults from other frames, and statistics gathered during processing, and also some data configured by user commands in input files.

User commands may read symbols from this dictionary, and may modify the objects to which the symbol names refer, but are protected from rebinding the names to other objects or values.

The organisation of the process frame is currently haphazard and may change from version to version.

Make an object to hold global variables that user objects can hang onto, to ensure these variables live during the execution of the object destructors.

Start python section to interscript/frames/processf.py[1 /2 ] Next Last
     1: #line 22 "process_frame.ipk"
     2: from interscript.frames.site import site_frame
     3: from interscript.frames.platform import platform_frame
     4: from interscript.frames.masterf import master_frame
     5: from interscript.drivers.sources.base import eoi
     6: import sys
     7: import traceback
     8: import time
     9: 
    10: class process_frame:
    11:   def __init__(self, global_frame, process_options, argument_frames):
    12:     self.global_frame = global_frame
    13:     self.process_options = process_options
    14:     self.argument_frames = argument_frames
    15: 
    16:     self.break_on_error = 0
    17:     self.debug_constructors = 0
    18:     self.debug_destructors = 0
    19:     self.verbosity = process_options.verbosity
    20:     self.update_files = 1
    21: 
    22:     plat = platform_frame()
    23:     self.site_frame = site_frame(plat)
    24:     # self.site_frame.print_install()
    25: 
    26:   def run(self):
    27:     oldstdout = sys.stdout
    28:     oldstderr = sys.stderr
    29:     f = self.process_options.logfile
    30:     m = self.process_options.logfile_mode
    31:     if self.process_options.logfile:
    32:       try:
    33:         sys.stderr = sys.stdout = open(f,m)
    34:       except IOError:
    35:         print 'Cannot open specified logfile',f
    36:       except:
    37:         print 'Weird error opening specified logfile',f
    38:         traceback.print_exc()
    39: 
    40:     reference_date = time.time()
    41:     local_time = time.localtime(reference_date)
    42:     local_time_string = time.strftime("%a %d %b, %Y %H:%M:%S (%Z)",local_time)
    43:     start_time = time.clock()
    44:     if m: print '<CDATA>'
    45:     print
    46:     print '---------------------------------'
    47:     print 'Interscript '+self.global_frame.version +\
    48:       '['+str(self.global_frame.buildno)+'] Process',local_time_string
    49: 
    50:     try:
    51:       for argument_frame in self.argument_frames:
    52:         master_frame(self,argument_frame)
    53:     finally:
    54:       end_time = time.clock()
    55:       elapsed_time = end_time - start_time
    56:       print 'Elapsed Process Time',int(elapsed_time),'seconds'
    57:       print '================================'
    58:       print
    59:       sys.stdout = oldstdout
    60:       sys.stderr = oldstderr
    61: 
    62:   def get_process_frame(self): return self
    63: 
End python section to interscript/frames/processf.py[1]


6.13.7.1. Execute Python Script