views:

37

answers:

1

I have a python webapp which accepts some data via POST. The method which is called can take a while to complete (30-60s), so I would like to "background" the method so I can respond to the user with a "processing" message.

The data is quite sensitive, so I'd prefer not to use any queue-based solutions. I also want to ensure that the backgrounded method doesn't get interrupted should the webapp fail in any way.

My first thought is to fork a process, however I'm unsure how I can pass variables to a process.

I've used Gevent before, which has a handy method: gevent.spawn(function, *args, **kwargs). Is there anything like this that I could use at the process-level?

Any other advice?

+1  A: 

The simplest approach would be to use a thread. Pass data to and from a thread with a Queue.

Eli Bendersky
No queues! Can't you read the question?
Aaron Gallagher
I hope my sarcasm detector isn't broken -_-
Dana the Sane
I'm a people person! I am good a dealing with people!! WHAT THE HELL IS WRONG WITH YOU PEOPLE!!
jathanism
Eli Bendersky