← Back to team overview

maas-devel team mailing list archive

Spinning up event loop in region webapp

 

lp:~allenap/maas/amp-on-cluster has example code for spinning up a
Twisted event loop in the region web application, via crochet. It also
shows how to expose a remote function via AMP in the cluster, and
there's an example client (usable from the command-line) in the root.

There's one issue:

  $ make syncdb
  $ make services/database/@start

  $ make services/webapp/@run
  Starting event loop in process 25744
  Hello from process 25744
  Starting event loop in process 25758
  Hello from process 25758
  Validating models...

  0 errors found
  January 20, 2014 - 22:52:48
  Django version 1.5.4, using settings 'maas.demo'
  Development server is running at http://127.0.0.1:5243/
  Quit the server with CONTROL-C.
  Hello from process 25744
  Hello from process 25758
  Hello from process 25744
  Hello from process 25758
  ...

In case you missed it, two event loops are being started.

I'm guessing that this might be related to Django's development server,
which can auto-reload iirc. I'm wondering if there's a way to prevent
the start-up code from being run in both processes?


Follow ups