Changeset 1499

Show
Ignore:
Timestamp:
05/25/04 11:15:15 (20 years ago)
Author:
jalet
Message:

accounter.py : old code deleted
the rest : now exports PYKOTAPRECOMPUTEDJOBSIZE and PYKOTAPRECOMPUTEDJOBPRICE

Location:
pykota/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r1498 r1499  
    2424# 
    2525# $Log$ 
     26# Revision 1.52  2004/05/25 09:15:13  jalet 
     27# accounter.py : old code deleted 
     28# the rest : now exports PYKOTAPRECOMPUTEDJOBSIZE and PYKOTAPRECOMPUTEDJOBPRICE 
     29# 
    2630# Revision 1.51  2004/05/25 08:31:16  jalet 
    2731# Heavy CPU usage seems to be fixed at least ! 
     
    265269            if self.config.getPrinterEnforcement(printer.Name) == "STRICT" : 
    266270                self.softwareJobSize = self.precomputeJobSize() 
    267                 self.logdebug("Precomputed job's size is : %s pages" % self.softwareJobSize) 
    268271                self.softwareJobPrice = userpquota.computeJobPrice(self.softwareJobSize) 
     272                self.logdebug("Precomputed job's size is %s pages, price is %s units" % (self.softwareJobSize, self.softwareJobPrice)) 
     273            os.putenv("PYKOTAPRECOMPUTEDJOBSIZE", str(self.softwareJobSize))     
     274            os.putenv("PYKOTAPRECOMPUTEDJOBPRICE", str(self.softwareJobPrice))     
    269275            action = self.warnUserPQuota(userpquota) 
    270276             
  • pykota/trunk/conf/pykota.conf.sample

    r1495 r1499  
    453453# PYKOTASTATUS : contains "CANCELLED" when SIGTERM was received by PyKota 
    454454#                else is not set. 
     455# PYKOTAPRECOMPUTEDJOBSIZE : contains the precomputed job's size 
     456# PYKOTAPRECOMPUTEDJOBPRICE : contains the precomputed job's price 
     457# 
    455458 
    456459# PreHook : gets executed after being sure the user, printer and user quota 
  • pykota/trunk/NEWS

    r1498 r1499  
    2424    - 1.19alpha14 : 
    2525     
     26        - PYKOTAPRECOMPUTEDJOBSIZE and PYKOTAPRECOMPUTEDJOBPRICE  
     27          are now exported as environment variables. 
     28           
    2629        - Heavy CPU usage is now completely fixed it seems, by  
    2730          introducing some 0.01 second sleeping when nothing to do. 
  • pykota/trunk/pykota/accounter.py

    r1495 r1499  
    2222# 
    2323# $Log$ 
     24# Revision 1.16  2004/05/25 09:15:15  jalet 
     25# accounter.py : old code deleted 
     26# the rest : now exports PYKOTAPRECOMPUTEDJOBSIZE and PYKOTAPRECOMPUTEDJOBPRICE 
     27# 
    2428# Revision 1.15  2004/05/24 22:45:49  jalet 
    2529# New 'enforcement' directive added 
     
    7175 
    7276import sys 
    73 from pykota import pdlanalyzer 
    7477 
    7578class PyKotaAccounterError(Exception): 
     
    8891        self.filter = kotafilter 
    8992        self.arguments = arguments 
    90         self.firstPassSize = None 
    91          
    92     def getSoftwareJobSize(self) :     
    93         """Pre-computes the job's size with a software method.""" 
    94         if self.filter.preserveinputfile is None : 
    95             raise PyKotaAccounterError, "Only supports raw jobs for now.""" 
    96         else :     
    97             fname = self.filter.preserveinputfile 
    98         parser = pdfanalyzer.PDLAnalyzer(fname)     
    99         try :  
    100             jobsize = parser.getJobSize() 
    101         except TypeError, msg :     
    102             raise PyKotaAccounterError, msg 
    103         else :     
    104             self.firstPassSize = jobsize 
    10593         
    10694    def getLastPageCounter(self) :