Show
Ignore:
Timestamp:
09/01/04 01:29:53 (20 years ago)
Author:
jalet
Message:

Introduction of the new 'onaccountererror' configuration directive.
Small fix for software accounter's return code which can't be None anymore.
Make software and hardware accounting code look similar : will be factorized
later.

Files:
1 modified

Legend:

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

    r1680 r1687  
    2222# 
    2323# $Log$ 
     24# Revision 1.10  2004/08/31 23:29:53  jalet 
     25# Introduction of the new 'onaccountererror' configuration directive. 
     26# Small fix for software accounter's return code which can't be None anymore. 
     27# Make software and hardware accounting code look similar : will be factorized 
     28# later. 
     29# 
    2430# Revision 1.9  2004/08/25 22:34:39  jalet 
    2531# Now both software and hardware accounting raise an exception when no valid 
     
    99105         
    100106        try : 
    101             retcode = child.wait() 
     107            status = child.wait() 
    102108        except OSError, msg :     
    103109            self.filter.printInfo(_("Problem while waiting for software accounter pid %s to exit : %s") % (child.pid, msg)) 
    104110        else :     
    105             if os.WIFEXITED(retcode) : 
    106                 status = os.WEXITSTATUS(retcode) 
    107             else :     
    108                 status = retcode 
     111            if os.WIFEXITED(status) : 
     112                status = os.WEXITSTATUS(status) 
    109113            self.filter.printInfo(_("Software accounter %s exit code is %s") % (self.arguments, str(status))) 
    110114             
    111115        if pagecounter is None :     
    112             raise PyKotaAccounterError, _("Unable to compute job size with accounter %s") % self.arguments 
     116            message = _("Unable to compute job size with accounter %s") % self.arguments 
     117            if self.onerror == "CONTINUE" : 
     118                self.filter.printInfo(message, "error") 
     119            else : 
     120                raise PyKotaAccounterError, message 
    113121             
    114         self.filter.logdebug("Software accounter %s said job is %s pages long." % (self.arguments, pagecounter)) 
    115         return pagecounter     
    116              
     122        self.filter.logdebug("Software accounter %s said job is %s pages long." % (self.arguments, repr(pagecounter))) 
     123        return pagecounter or 0