Created
October 21, 2013 01:50
-
-
Save vanatteveldt/7077564 to your computer and use it in GitHub Desktop.
This file contains 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
import settings, sys | |
import time | |
from amcat.tasks import do_scrape, FakeScraper | |
from celery.result import AsyncResult | |
res = do_scrape.delay(FakeScraper, 3) | |
while True: | |
if not res.ready(): | |
time.sleep(.2) | |
sys.stdout.write("."); sys.stdout.flush() | |
continue | |
r = res.get() | |
if isinstance(r, AsyncResult): | |
print "Intermediate result.... waiting for next phase" | |
res = r | |
else: | |
break | |
print "\n---->", type(r), `r`, r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment