def wait_for_scan(self, cookie): """ Waits for scanners to complete """ import pyflag.Farm as Farm while Farm.get_cookie_reference(cookie) > 0: time.sleep(0.5) return print "Waiting for cookie %s" % cookie pdbh = DB.DBO() ## Often this process owns a worker as well. In that case we can wake it up: import pyflag.Farm as Farm #Farm.wake_workers() ## Wait until there are no more jobs left. while 1: pdbh.execute("select * from jobs where cookie=%r limit 1", (cookie)) row = pdbh.fetch() if not row: break time.sleep(1)
def wait_for_scan(self, cookie): """ Waits for scanners to complete """ import pyflag.Farm as Farm while Farm.get_cookie_reference(cookie)>0: time.sleep(0.5) return print "Waiting for cookie %s" % cookie pdbh = DB.DBO() ## Often this process owns a worker as well. In that case we can wake it up: import pyflag.Farm as Farm #Farm.wake_workers() ## Wait until there are no more jobs left. while 1: pdbh.execute("select * from jobs where cookie=%r limit 1", (cookie)) row = pdbh.fetch() if not row: break time.sleep(1)