Show
Ignore:
Timestamp:
05/29/07 23:03:12 (17 years ago)
Author:
jerome
Message:

Now the various delays are configurable when using hardware accounting,
through the newly introduced 'statusstabilizationdelay' and 'statusstabilizationloops'
directives in pykota.conf

Location:
pykota/trunk/pykota/accounters
Files:
2 modified

Legend:

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

    r3177 r3180  
    169169    def waitPrinting(self) : 
    170170        """Waits for printer status being 'printing'.""" 
    171         try : 
    172             noprintingmaxdelay = int(self.parent.filter.config.getNoPrintingMaxDelay(self.parent.filter.PrinterName)) 
    173         except (TypeError, AttributeError) : # NB : AttributeError in testing mode because I'm lazy ! 
    174             noprintingmaxdelay = constants.NOPRINTINGMAXDELAY 
    175             self.parent.filter.logdebug("No max delay defined for printer %s, using %i seconds." % (self.parent.filter.PrinterName, noprintingmaxdelay)) 
     171        statusstabilizationdelay = constants.get(self.parent.filter, "StatusStabilizationDelay") 
     172        noprintingmaxdelay = constants.get(self.parent.filter, "NoPrintingMaxDelay") 
    176173        if not noprintingmaxdelay : 
    177174            self.parent.filter.logdebug("Will wait indefinitely until printer %s is in 'printing' state." % self.parent.filter.PrinterName) 
     
    212209                            break 
    213210            self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName) 
    214             time.sleep(constants.ITERATIONDELAY) 
     211            time.sleep(statusstabilizationdelay) 
    215212         
    216213    def waitIdle(self) : 
    217214        """Waits for printer status being 'idle'.""" 
     215        statusstabilizationdelay = constants.get(self.parent.filter, "StatusStabilizationDelay") 
     216        statusstabilizationloops = constants.get(self.parent.filter, "StatusStabilizationLoops") 
    218217        idle_num = 0 
    219218        while True : 
     
    226225                    return  
    227226                idle_num += 1 
    228                 if idle_num >= constants.STABILIZATIONDELAY : 
     227                if idle_num >= statusstabilizationloops : 
    229228                    # printer status is stable, we can exit 
    230229                    break 
     
    232231                idle_num = 0 
    233232            self.parent.filter.logdebug(_("Waiting for printer %s's idle status to stabilize...") % self.parent.filter.PrinterName) 
    234             time.sleep(constants.ITERATIONDELAY) 
     233            time.sleep(statusstabilizationdelay) 
    235234     
    236235    def retrieveInternalPageCounter(self) : 
  • pykota/trunk/pykota/accounters/snmp.py

    r3175 r3180  
    154154    def waitPrinting(self) : 
    155155        """Waits for printer status being 'printing'.""" 
    156         try : 
    157             noprintingmaxdelay = int(self.parent.filter.config.getNoPrintingMaxDelay(self.parent.filter.PrinterName)) 
    158         except (TypeError, AttributeError) : # NB : AttributeError in testing mode because I'm lazy ! 
    159             noprintingmaxdelay = constants.NOPRINTINGMAXDELAY 
    160             self.parent.filter.logdebug("No max delay defined for printer %s, using %i seconds." % (self.parent.filter.PrinterName, noprintingmaxdelay)) 
     156        statusstabilizationdelay = constants.get(self.parent.filter, "StatusStabilizationDelay") 
     157        noprintingmaxdelay = constants.get(self.parent.filter, "NoPrintingMaxDelay") 
    161158        if not noprintingmaxdelay : 
    162159            self.parent.filter.logdebug("Will wait indefinitely until printer %s is in 'printing' state." % self.parent.filter.PrinterName) 
     
    203200                            break 
    204201            self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName)     
    205             time.sleep(constants.ITERATIONDELAY) 
     202            time.sleep(statusstabilizationdelay) 
    206203         
    207204    def waitIdle(self) : 
    208205        """Waits for printer status being 'idle'.""" 
     206        statusstabilizationdelay = constants.get(self.parent.filter, "StatusStabilizationDelay") 
     207        statusstabilizationloops = constants.get(self.parent.filter, "StatusStabilizationLoops") 
    209208        idle_num = idle_flag = 0 
    210209        while 1 : 
     
    225224                    return  
    226225                idle_num += 1 
    227                 if idle_num >= constants.STABILIZATIONDELAY : 
     226                if idle_num >= statusstabilizationloops : 
    228227                    # printer status is stable, we can exit 
    229228                    break 
     
    231230                idle_num = 0 
    232231            self.parent.filter.logdebug(_("Waiting for printer %s's idle status to stabilize...") % self.parent.filter.PrinterName)     
    233             time.sleep(constants.ITERATIONDELAY) 
     232            time.sleep(statusstabilizationdelay) 
    234233             
    235234    def retrieveInternalPageCounter(self) :