Changeset 3285 for pykota/trunk/pykota/accounters
- Timestamp:
- 01/09/08 00:17:47 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounters/software.py
r3275 r3285 75 75 """Does software accounting through an external script.""" 76 76 self.filter.printInfo(_("Launching SOFTWARE(%s)...") % self.arguments) 77 MEGABYTE = 1024*1024 78 infile = open(self.filter.DataFile, "rb") 79 child = popen2.Popen4(self.arguments) 77 pagecounter = None 78 child = os.popen(self.arguments, "r") 80 79 try : 81 data = infile.read(MEGABYTE) 82 while data : 83 child.tochild.write(data) 84 data = infile.read(MEGABYTE) 85 child.tochild.flush() 86 child.tochild.close() 87 except (IOError, OSError), msg : 88 msg = "%s : %s" % (self.arguments, msg) 89 self.filter.printInfo(_("Unable to compute job size with accounter %s") % msg) 90 infile.close() 91 pagecounter = None 92 try : 93 answer = child.fromchild.read() 80 answer = child.read() 94 81 except (IOError, OSError), msg : 95 82 msg = "%s : %s" % (self.arguments, msg) … … 104 91 else : 105 92 break 106 child.fromchild.close()107 93 94 status = child.close() 108 95 try : 109 status = child.wait()110 except OSError, msg :111 self.filter.printInfo(_("Problem while waiting for software accounter pid %s to exit : %s") % (child.pid, msg))112 else :113 96 if os.WIFEXITED(status) : 114 97 status = os.WEXITSTATUS(status) 115 self.filter.printInfo(_("Software accounter %s exit code is %s") % (self.arguments, str(status))) 98 except TypeError : 99 pass # None means no error occured. 100 self.filter.printInfo(_("Software accounter %s exit code is %s") % (self.arguments, str(status))) 116 101 117 102 if pagecounter is None :