Drupal python background server

By dgtlmoon - Posted on 17 July 2008

Heres some code attached I wrote last year but havent published it on drupal.org just yet, it's my python background server for drupal actions, or put simply "Asynchronous python daemon for Drupal interaction"

Just perfect for managing actions that require long, cpu or filesystem intensive operations such as encrypting, building a file, or even interfacing with other hardware/usb/bluetooth etc etc

This is born out of the need to have a workflow actions trigger where those actions execute independently of the main Drupal/PHP thread (as PHP does not offer any form of threading).

Effectively you are making an asychronous call to trigger a new thread for each request in the python daemon (which returns immediately to allow your drupal application to continue executing) in the python layer from the PHP layer via XML-RPC and drupal actions.

Fortunately the serialized node object from drupal, and python's un-serialize are compatible! so you can send your node to your python layer via XML-RPC with no fuss.

Finally, the python layer communicates back with the PHP layer to inform the PHP/Drupal that the action is complete and to transition the workflow.

See attached code, includes drupal module and python backend server.

Your rating: None Average: 4 (1 vote)
AttachmentSize
drupal_background.tgz5.84 KB

Reply

The content of this field is kept private and will not be shown publicly.
 
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.