0

I'd like to:

  1. Send request from the browser to a python CGI script
  2. This request will start some very long operation
  3. The browser should check progress of that operation every 3 seconds

How can I do that?

1
  • JS on the client-side, a Python script which will query the operation somehow on the server. Commented Aug 8, 2011 at 14:29

2 Answers 2

1

On the server side, you should probably look into some background queue / job runner of sorts, otherwise your request will be blocked once the long operation starts (depends on your server). I hear Celery is pretty good. On the client side, do some polling every x seconds that checks the job status. If you're feeling adventurous, you could experiment with websockets, although they're not supported natively in all browsers (you could use 3rd party extensions to try and accomplish cross browser support).

Sign up to request clarification or add additional context in comments.

Comments

1

You could do this -

  1. Use Javascript to check progress every 3 seconds.
  2. Your Python script hit at anytime should give the progress at that instance. It should essentially act as state-machine. You need a server here or maybe the progress is stored on some file.

But having a server is the way to go... Maybe the long running process stores the progress in a MySQL table.

Hope this helps...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.