Last active
August 29, 2015 14:00
-
-
Save gparuthi/11183609 to your computer and use it in GitHub Desktop.
Python Utilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Publish progress to redis | |
# publish the status of a long running parallel from ipy cluster process to a redis server | |
# a webservice can then read this and feed it to a javascript visualization | |
def pub_to_redis(pres, title): | |
import Redis | |
r = redis.StrictRedis(host='localhost', port=6379, db=0) | |
n = len(pres) | |
p = ProgressBar.ProgressBar(n) | |
while True: | |
c = pres.progress | |
r.set(title+':c',c) | |
r.set(title+':n',n) | |
p.animate(c) | |
time.sleep(5) | |
pres = lview.map_async(func, list_of_elements) | |
pub_to_redis(pres, 'kiva_get_lender_teams') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment