- Timestamp:
- 02/21/06 19:42:25 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r2739 r2742 29 29 import pwd 30 30 import grp 31 import time 31 32 from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 32 33 from pykota.config import PyKotaConfigError … … 162 163 if options["delete"] : 163 164 self.display("%s...\n" % _("Deletion")) 164 printers = self.storage.getMatchingPrinters(options["printer"]) 165 entries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names)) 166 nbtotal = len(entries) * len(printers) 167 i = 0 168 for printer in printers : 169 for entry in entries : 170 pqentry = getattr(self.storage, "get%sPQuota" % suffix)(entry, printer) 171 if pqentry.Exists : 172 pqentry.delete() 173 i += 1 174 percent = 100.0 * float(i) / float(nbtotal) 175 self.display("\r%.02f%%" % percent) 165 #printers = self.storage.getMatchingPrinters(options["printer"]) 166 #entries = getattr(self.storage, "getMatching%ss" % suffix)(",".join(names)) 167 before = time.time() 168 (printers, entries, pqentries) = getattr(self.storage, "getPrinters%ssAndPQuotas" % suffix)(printernames, names) 169 after = time.time() 170 self.printInfo("Data extraction took %.4f seconds" % (after - before)) 171 nbtotal = len(pqentries) 172 for i in range(nbtotal) : 173 (pqkey, pqentry) = pqentries.popitem() 174 if pqentry.Exists : 175 pqentry.delete() 176 percent = 100.0 * float(i) / float(nbtotal) 177 self.display("\r%.02f%%" % percent) 176 178 else : 177 179 if not names : … … 317 319 318 320 if __name__ == "__main__" : 321 try : 322 import psyco 323 psyco.profile() 324 except : 325 pass 319 326 retcode = 0 320 327 try : -
pykota/trunk/pykota/storages/sql.py
r2735 r2742 467 467 users = {} 468 468 upquotas = {} 469 import time 470 before = time.time() 469 471 result = self.doSearch("SELECT users.id AS uid, users.description AS udesc, printers.id AS pid, printers.description AS pdesc, printers.maxjobsize AS pmaxjobsize, userpquota.id AS upqid, userpquota.maxjobsize AS upqmaxjobsize, users.*, printers.*, userpquota.* FROM users, printers, userpquota WHERE users.id=userpquota.userid AND printers.id=userpquota.printerid;") 472 after = time.time() 473 self.tool.printInfo("SELECT took %.4f seconds." % (after - before)) 470 474 if result : 471 475 for record in result :