views:

51

answers:

1

I'm not sure what's the appropriate terminology here, but I'd like to have an application running passively that is ready to accept commands without having to reinitialize the whole thing.

The precise application is a machine learning system written in Python that takes a somewhat long time to train a classifier or to load a cached classifier. Once the classifier is loaded into memory, test cases or predictions made by the classifier happen very quickly.

I want to have to speed advantage of having the classifier already loaded into memory without having to reclassify/reload so that I can access the classifier quickly through other interfaces (command line, PHP, etc.).

This reminds me of asynchrony in Javascript, and I imagine some of the same underlying concepts are used here.

What's the best way to go about doing this?

+2  A: 

Depending on your implementation this is known as a server process, a daemon, a Windows service etc.

A typical implementation will run and accept incoming network connections and service those for clients (e.g. an HTTP server). Some threading or other asynchronous mechanism will exist to allow servicing of multiple clients simultaneously (you may not need this, depending on your requirements).

Brian Agnew
If you can do what you need using a simple request/response model, the quickest and easiest solution would be XML-RPC.
LeafStorm
What LeafStorm said. Check out pylons or django, too.
Brendan Abel