Changeset 3162 for pykota/trunk/pykota

Show
Ignore:
Timestamp:
04/14/07 10:50:47 (17 years ago)
Author:
jerome
Message:

Added the 'skipinitialwait' directive to pykota.conf.
This halves the inter-job delay when using hardware accounting
when set.

Location:
pykota/trunk/pykota
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/hardware.py

    r3133 r3162  
    109109           The external command must report the life time page number of the printer on stdout. 
    110110        """ 
     111        skipinitialwait = self.filter.config.getPrinterSkipInitialWait(printer) 
    111112        commandline = self.arguments.strip() % locals() 
    112113        cmdlower = commandline.lower() 
    113114        if (cmdlower == "snmp") or cmdlower.startswith("snmp:") : 
    114             return snmp.Handler(self, printer).retrieveInternalPageCounter() 
     115            return snmp.Handler(self, printer, skipinitialwait).retrieveInternalPageCounter() 
    115116        elif (cmdlower == "pjl") or cmdlower.startswith("pjl:") : 
    116             return pjl.Handler(self, printer).retrieveInternalPageCounter() 
     117            return pjl.Handler(self, printer, skipinitialwait).retrieveInternalPageCounter() 
    117118             
    118119        if printer is None : 
  • pykota/trunk/pykota/accounters/pjl.py

    r3133 r3162  
    5858class Handler : 
    5959    """A class for PJL print accounting.""" 
    60     def __init__(self, parent, printerhostname) : 
     60    def __init__(self, parent, printerhostname, skipinitialwait=False) : 
    6161        self.parent = parent 
    6262        self.printerHostname = printerhostname 
     63        self.skipinitialwait = skipinitialwait 
    6364        try : 
    6465            self.port = int(self.parent.arguments.split(":")[1].strip()) 
     
    181182        while 1 : 
    182183            self.retrievePJLValues() 
     184            if (self.printerInternalPageCounter is not None) \ 
     185               and self.skipinitialwait \ 
     186               and (os.environ.get("PYKOTAPHASE") == "BEFORE") : 
     187                self.parent.filter.logdebug("No need to wait for the printer to be idle, this should be the case already.") 
     188                return  
    183189            idle_flag = 0 
    184190            if self.printerStatus in ('10000', '10001', '35078', '40000') : 
  • pykota/trunk/pykota/accounters/snmp.py

    r3161 r3162  
    109109class BaseHandler : 
    110110    """A class for SNMP print accounting.""" 
    111     def __init__(self, parent, printerhostname) : 
     111    def __init__(self, parent, printerhostname, skipinitialwait=False) : 
    112112        self.parent = parent 
    113113        self.printerHostname = printerhostname 
     114        self.skipinitialwait = skipinitialwait 
    114115        try : 
    115116            self.community = self.parent.arguments.split(":")[1].strip() 
     
    210211        while 1 : 
    211212            self.retrieveSNMPValues() 
     213            if (self.printerInternalPageCounter is not None) \ 
     214               and self.skipinitialwait \ 
     215               and (os.environ.get("PYKOTAPHASE") == "BEFORE") : 
     216                self.parent.filter.logdebug("No need to wait for the printer to be idle, this should be the case already.") 
     217                return  
    212218            pstatusAsString = printerStatusValues.get(self.printerStatus) 
    213219            dstatusAsString = deviceStatusValues.get(self.deviceStatus) 
  • pykota/trunk/pykota/config.py

    r3158 r3162  
    691691            else : 
    692692                del branches[k] # empty value disables a global option 
    693                  
    694693        return branches 
     694         
     695    def getPrinterSkipInitialWait(self, printername) : 
     696        """Returns True if we want to skip the initial waiting loop, else False.""" 
     697        try : 
     698            return self.isTrue(self.getPrinterOption(printername, "skipinitialwait")) 
     699        except PyKotaConfigError : 
     700            return False 
  • pykota/trunk/pykota/version.py

    r3153 r3162  
    2222# 
    2323 
    24 __version__ = "1.26alpha4_unofficial" 
     24__version__ = "1.26alpha5_unofficial" 
    2525 
    2626__doc__ = "PyKota : a complete Printing Quota Solution for CUPS."