Skip to content

Instantly share code, notes, and snippets.

@vanatteveldt
Created October 21, 2013 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanatteveldt/7077564 to your computer and use it in GitHub Desktop.
Save vanatteveldt/7077564 to your computer and use it in GitHub Desktop.
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