← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/maas/txlongpoll-update into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/txlongpoll-update into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/maas/txlongpoll-update/+merge/97438

This does a few things:

- Updates txlongpoll to 0.3.1.

- Refers to txlongpoll everywhere as "txlongpoll" instead of "longpoll" sometimes; I tripped over that a few times.

- Puts pid files and logs into subdirectories for both pserv and txlongpoll.

- Throw away the default Twisted log output from pserv and txlongpoll; we handle logs differently.

- Change the {pserv,txlongpoll}.pid rules in Makefile so that the prerequisites are order-only (the | in the rule line). This has the effect that prerequisites that are newer than the pid file do not cause the rule to get executed again.

-- 
https://code.launchpad.net/~allenap/maas/txlongpoll-update/+merge/97438
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/txlongpoll-update into lp:maas.
=== modified file '.bzrignore'
--- .bzrignore	2012-03-13 10:40:15 +0000
+++ .bzrignore	2012-03-14 16:09:22 +0000
@@ -12,15 +12,11 @@
 ./docs/api.rst
 ./download-cache
 ./eggs
-./logs
-./longpoll.pid
+./logs/*
 ./media/demo/*
 ./media/development
 ./parts
-./pserv.log
-./pserv.pid
+./run/*.pid
 ./TAGS
 ./tags
-./twistd.log
 ./twisted/plugins/dropin.cache
-./txlongpoll.log

=== modified file 'Makefile'
--- Makefile	2012-03-13 11:50:12 +0000
+++ Makefile	2012-03-14 16:09:22 +0000
@@ -4,7 +4,7 @@
     bin/buildout \
     bin/maas bin/test.maas \
     bin/twistd.pserv bin/test.pserv \
-    bin/twistd.longpoll \
+    bin/twistd.txlongpoll \
     bin/py bin/ipy
 
 all: build doc
@@ -29,8 +29,8 @@
 	bin/buildout install pserv-test
 	@touch --no-create $@
 
-bin/twistd.longpoll: bin/buildout buildout.cfg setup.py
-	bin/buildout install longpoll
+bin/twistd.txlongpoll: bin/buildout buildout.cfg setup.py
+	bin/buildout install txlongpoll
 	@touch --no-create $@
 
 bin/flake8: bin/buildout buildout.cfg setup.py
@@ -73,32 +73,36 @@
 	find . -type f -name '*~' -print0 | xargs -r0 $(RM)
 	$(RM) -r media/demo/* media/development
 
-distclean: clean pserv-stop longpoll-stop
+distclean: clean pserv-stop txlongpoll-stop
 	utilities/maasdb delete-cluster ./db/
 	$(RM) -r eggs develop-eggs
-	$(RM) -r bin build dist logs parts
+	$(RM) -r bin build dist logs/* parts
 	$(RM) tags TAGS .installed.cfg
 	$(RM) -r *.egg *.egg-info src/*.egg-info
 	$(RM) docs/api.rst
 	$(RM) -r docs/_build/
 
-pserv.pid: bin/twistd.pserv
-	bin/twistd.pserv --pidfile=$@ maas-pserv --config-file=etc/pserv.yaml
-
-pserv-start: pserv.pid
-
+run/pserv.pid: | bin/twistd.pserv etc/pserv.yaml
+	bin/twistd.pserv --logfile=/dev/null --pidfile=$@ \
+	    maas-pserv --config-file=etc/pserv.yaml
+
+pserv-start: run/pserv.pid
+
+pserv-stop: pidfile=run/pserv.pid
 pserv-stop:
-	{ test -e pserv.pid && cat pserv.pid; } | xargs --no-run-if-empty kill
-
-longpoll.pid: bin/twistd.longpoll
-	bin/twistd.longpoll --pidfile=$@ txlongpoll -u guest -a guest -f 4545
-
-longpoll-start: longpoll.pid
-
-longpoll-stop:
-	{ test -e longpoll.pid && cat longpoll.pid; } | xargs --no-run-if-empty kill
-
-run: bin/maas dev-db pserv.pid longpoll.pid
+	{ test -e $(pidfile) && cat $(pidfile); } | xargs --no-run-if-empty kill
+
+run/txlongpoll.pid: | bin/twistd.txlongpoll etc/txlongpoll.yaml
+	bin/twistd.txlongpoll --logfile=/dev/null --pidfile=$@ \
+	    txlongpoll --config-file=etc/txlongpoll.yaml
+
+txlongpoll-start: run/txlongpoll.pid
+
+txlongpoll-stop: pidfile=run/txlongpoll.pid
+txlongpoll-stop:
+	{ test -e $(pidfile) && cat $(pidfile); } | xargs --no-run-if-empty kill
+
+run: bin/maas dev-db run/pserv.pid run/txlongpoll.pid
 	bin/maas runserver 0.0.0.0:8000 --settings=maas.demo
 
 harness: bin/maas dev-db
@@ -107,7 +111,6 @@
 syncdb: bin/maas dev-db
 	bin/maas syncdb --noinput
 
-
 checkbox: config=checkbox/plugins/jobs_info/directories=$(PWD)/qa/checkbox
 checkbox:
 	checkbox-gtk --config=$(config) --whitelist-file=
@@ -115,5 +118,5 @@
 .PHONY: \
     build check checkbox clean dev-db distclean doc \
     harness lint pserv-start pserv-stop run \
-    longpoll-start longpoll-stop \
+    txlongpoll-start txlongpoll-stop \
     syncdb test sampledata

=== modified file 'buildout.cfg'
--- buildout.cfg	2012-03-12 16:25:51 +0000
+++ buildout.cfg	2012-03-14 16:09:22 +0000
@@ -7,7 +7,7 @@
   pserv-test
   repl
   sphinx
-  longpoll
+  txlongpoll
 extensions = buildout-versions
 buildout_versions_file = versions.cfg
 versions = versions
@@ -158,7 +158,7 @@
 interpreter = py
 scripts = ipython=ipy
 
-[longpoll]
+[txlongpoll]
 recipe = z3c.recipe.scripts
 eggs =
   txlongpoll
@@ -167,6 +167,5 @@
   pyyaml
   twisted
   txamqp
-entry-points = twistd.longpoll=twisted.scripts.twistd:run
-scripts = twistd.longpoll
-
+entry-points = twistd.txlongpoll=twisted.scripts.twistd:run
+scripts = twistd.txlongpoll

=== modified file 'etc/pserv.yaml'
--- etc/pserv.yaml	2012-03-12 17:31:27 +0000
+++ etc/pserv.yaml	2012-03-14 16:09:22 +0000
@@ -10,12 +10,15 @@
 ## running server.
 #
 # logfile: "pserv.log"
+logfile: "logs/pserv.log"
 
 ## OOPS configuration (optional).
 #
 oops:
   # directory:
+  directory: "logs"
   # reporter:
+  reporter: "maas-pserv"
 
 ## Message broker configuration (optional, not currently used).
 #

=== added file 'etc/txlongpoll.yaml'
--- etc/txlongpoll.yaml	1970-01-01 00:00:00 +0000
+++ etc/txlongpoll.yaml	2012-03-14 16:09:22 +0000
@@ -0,0 +1,36 @@
+##
+## txlongpoll configuration.
+##
+
+## The front-end service.
+#
+frontend:
+  ## The port on which to serve.
+  port: 4545
+  ## If specified, queue names requested must have the given prefix.
+  # prefix:
+
+## OOPS configuration.
+#
+oops:
+  ## Directory in which to place OOPS reports.
+  # directory: ""
+  directory: "logs"
+  ## The reporter used when generating OOPS reports.
+  # reporter: "LONGPOLL"
+  reporter: "maas-txlongpoll"
+
+## Message broker configuration.
+#
+broker:
+  # host: "localhost"
+  # port: 5672
+  # username: "guest"
+  # password: "guest"
+  # vhost: "/"
+
+## Where to log. This log can be rotated by sending SIGUSR1 to the
+## running server.
+#
+# logfile: "txlongpoll.log"
+logfile: "logs/txlongpoll.log"

=== added directory 'logs'
=== added directory 'run'
=== modified file 'setup.py'
--- setup.py	2012-03-09 13:00:59 +0000
+++ setup.py	2012-03-14 16:09:22 +0000
@@ -73,6 +73,7 @@
         'South',
         'Twisted',
         'txAMQP',
+        'txlongpoll',
         ],
     classifiers=[
         'Development Status :: 4 - Beta',

=== modified file 'src/maas/demo.py'
--- src/maas/demo.py	2012-03-14 14:03:33 +0000
+++ src/maas/demo.py	2012-03-14 16:09:22 +0000
@@ -23,6 +23,7 @@
     'debug_toolbar.middleware.DebugToolbarMiddleware',
 )
 
+<<<<<<< TREE
 # In dev mode: Django should act as a proxy to txlongpoll.
 LONGPOLL_SERVER_URL = "http://localhost:4545/";
 
@@ -31,6 +32,9 @@
 LONGPOLL_URL = None
 
 # This should match the setting in Makefile:pserv.pid.
+=======
+# This should match the setting in /etc/pserv.yaml.
+>>>>>>> MERGE-SOURCE
 PSERV_URL = "http://localhost:8001/api";
 
 RABBITMQ_PUBLISH = True

=== modified file 'versions.cfg'
--- versions.cfg	2012-03-12 16:25:51 +0000
+++ versions.cfg	2012-03-14 16:09:22 +0000
@@ -43,7 +43,7 @@
 django-debug-toolbar = 0.9.1
 
 # Longpoll stuff.
-txlongpoll = 0.2.12
+txlongpoll = 0.3.1
 setproctitle = 1.1.3
 oops-amqp = 0.0.6
 pymongo = 2.1.1