Display progress of a long running Python task in Django -
i have typical django structure set project , 1 web application.
the web application set user inputs information, , information taken input run python program.
this python program can take quite while finish (grabbing things web , doing text mining scoring) - can take multiple minutes load.
on command line, program periodically display in process (it'd first how many things found score against, it'd in number of things found in scoring process), useful. however, when moved on django set up, no longer have capability (at least, not in same way since sent log files).
the way set there input view, , results view. results view takes input , runs python program. won't display results until entire program run. on user side, browser sits there minutes before results displayed. obviously, not ideal.
does know of best way bring status information on task django?
i've looked celery little bit, think since i'm still beginner in django i'm confusing myself of documentation. instance: if task sent off asynchronously worker, how browser grab current state of program?? also, consistent documentation seems lacking celery on django (i've seen people set celery many different ways on django projects).
i appreciate input here, i've been stuck on while now.
my first suggestion psychologically separate celery django when start think of two. can run in same environment, celery asynchronous processes django http requests.
also remember celery unlike diango in requires other services function; message broker. using celery increase architectural requirements.
to address specific use case, you'll need system publish messages each celery task message broker , web client need subscribe messages.
there's lot involved here, short version can use redis celery message broker pub/sub service messages browser. can use e.g diango-redis-websockets subscribe browser task state messages in redis
Comments
Post a Comment