Author: eallen
Date: 2009-08-12 14:06:08 -0400 (Wed, 12 Aug 2009)
New Revision: 3563
Modified:
mgmt/trunk/cumin/python/cumin/util.py
Log:
Added optional args to wait() to allow passing args to the predicate method.
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2009-08-12 17:57:30 UTC (rev 3562)
+++ mgmt/trunk/cumin/python/cumin/util.py 2009-08-12 18:06:08 UTC (rev 3563)
@@ -80,12 +80,16 @@
ret = None
return ret
-def wait(predicate, timeout=30):
+def wait(predicate, timeout=30, args=None):
start = time()
while True:
- if predicate():
- return True
+ if args is not None:
+ if predicate(args):
+ return True
+ else:
+ if predicate():
+ return True
if time() - start > timeout:
return False
Show replies by date