cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject cloudstack-cloudmonkey git commit: CLOUDSTACK-8270: get rid of buggy dot completer, use spinning cursor to wait
Date Fri, 20 Feb 2015 12:30:08 GMT
Repository: cloudstack-cloudmonkey
Updated Branches:
  refs/heads/master 7f48184fe -> 39f53acc0


CLOUDSTACK-8270: get rid of buggy dot completer, use spinning cursor to wait

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/39f53acc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/39f53acc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/39f53acc

Branch: refs/heads/master
Commit: 39f53acc0e9b2724241c58fd07bca0fef9c6b482
Parents: 7f48184
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Fri Feb 20 17:59:31 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Fri Feb 20 17:59:31 2015 +0530

----------------------------------------------------------------------
 cloudmonkey/requester.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/39f53acc/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index 0ba9f12..e9bd452 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -21,6 +21,7 @@ try:
     import base64
     import hashlib
     import hmac
+    import itertools
     import json
     import requests
     import sys
@@ -270,14 +271,15 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, url,
         if not timeout:
             timeout = 3600
         timeout = int(timeout)
-        pollperiod = 2
-        progress = 1
+        cursor = itertools.cycle(['|', '/', '-', '\\'])
         while timeout > 0:
-            print '\r' + '.' * progress,
-            sys.stdout.flush()
-            time.sleep(pollperiod)
-            timeout = timeout - pollperiod
-            progress += 1
+            interval = 2
+            while interval > 0:
+                print '\r' + cursor.next(),
+                sys.stdout.flush()
+                time.sleep(0.1)
+                interval -= 0.1
+            timeout = timeout - 2
             logger_debug(logger, "Job %s to timeout in %ds" % (jobid, timeout))
 
             response, error = make_request(command, request, logger, url,
@@ -302,7 +304,7 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, url,
                         jobid, jobresult["errorcode"], jobresult["errortext"])
                 return response, error
             elif jobstatus == 1:
-                print "\r" + " " * progress
+                print "\r  "
                 return response, error
             elif jobstatus == 0:
                 pass  # Job in progress


Mime
View raw message