Show
Ignore:
Timestamp:
01/31/06 12:32:34 (18 years ago)
Author:
jerome
Message:

Introduced the 'preaccounter' directive.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r2632 r2635  
    380380        """Computes the job size with a software method.""" 
    381381        self.logdebug("Precomputing job's size...") 
    382         jobsize = 0 
    383         if self.JobSizeBytes : 
    384             try : 
    385                 from pkpgpdls import analyzer, pdlparser 
    386             except ImportError :     
    387                 self.printInfo("pkpgcounter is now distributed separately, please grab it from http://www.librelogiciel.com/software/pkpgcounter/action_Download", "error") 
    388                 self.printInfo("Precomputed job size will be forced to 0 pages.", "error") 
    389             else :      
    390                 infile = open(self.DataFile, "rb") 
    391                 try : 
    392                     parser = analyzer.PDLAnalyzer(infile) 
    393                     jobsize = parser.getJobSize() 
    394                 except pdlparser.PDLParserError, msg :     
    395                     # Here we just log the failure, but 
    396                     # we finally ignore it and return 0 since this 
    397                     # computation is just an indication of what the 
    398                     # job's size MAY be. 
    399                     self.printInfo(_("Unable to precompute the job's size with the generic PDL analyzer : %s") % msg, "warn") 
    400                 else :     
    401                     if self.InputFile is not None : 
    402                         # when a filename is passed as an argument, the backend  
    403                         # must generate the correct number of copies. 
    404                         jobsize *= self.Copies 
    405                 infile.close()         
    406         self.softwareJobSize = jobsize 
     382        self.preaccounter.beginJob(None) 
     383        self.preaccounter.endJob(None) 
     384        self.softwareJobSize = self.preaccounter.getJobSize(None) 
    407385        self.logdebug("Precomputed job's size is %s pages." % self.softwareJobSize) 
    408386         
     
    11781156            wrapper.initBackendParameters() 
    11791157            wrapper.saveDatasAndCheckSum() 
     1158            wrapper.preaccounter = openAccounter(wrapper, ispreaccounter=1) 
    11801159            wrapper.accounter = openAccounter(wrapper) 
    11811160            wrapper.precomputeJobSize()