├── .gitignore ├── .travis.yml ├── AUTHORS.rst ├── CONTRIBUTING.rst ├── DESCRIPTION.rst ├── HISTORY.rst ├── INSTALLATION.rst ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.rst ├── USAGE.rst ├── docs ├── Makefile ├── authors.rst ├── conf.py ├── contributing.rst ├── description.rst ├── history.rst ├── index.rst ├── installation.rst ├── make.bat └── usage.rst ├── requirements.txt ├── setup.py ├── supervisorserialrestart ├── __init__.py └── controllerplugin.py ├── tests ├── __init__.py ├── run_tests.py ├── supervisord.conf └── test_plugin.py └── tox.ini /.gitignore: -------------------------------------------------------------------------------- 1 | *.py~ 2 | *.html 3 | *.log 4 | *.pid 5 | *.py[cod] 6 | \#*\# 7 | .\#* 8 | 9 | # Packages 10 | *.egg 11 | *.egg-info 12 | dist 13 | build 14 | eggs 15 | parts 16 | bin 17 | var 18 | sdist 19 | develop-eggs 20 | .installed.cfg 21 | lib 22 | lib64 23 | 24 | # Installer logs 25 | pip-log.txt 26 | 27 | # Unit test / coverage reports 28 | .coverage 29 | .tox 30 | nosetests.xml 31 | htmlcov/ 32 | 33 | # Translations 34 | *.mo 35 | 36 | # Mr Developer 37 | .mr.developer.cfg 38 | .project 39 | .pydevproject 40 | 41 | # Complexity 42 | output/*.html 43 | output/*/index.html 44 | 45 | # Sphinx 46 | docs/_build 47 | docs/modules.rst 48 | docs/supervisorserialrestart.rst 49 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Config file for automatic testing at travis-ci.org 2 | 3 | language: python 4 | 5 | python: 6 | # - "3.3" 7 | - "2.7" 8 | - "2.6" 9 | - "pypy" 10 | 11 | # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors 12 | install: pip install -r requirements.txt 13 | 14 | # command to run tests, e.g. python setup.py test 15 | script: python setup.py test -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | Credits 3 | ======= 4 | 5 | Development Lead 6 | ---------------- 7 | 8 | * Sven Richter 9 | 10 | Contributors 11 | ------------ 12 | 13 | None yet. Why not be the first? -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Contributing 3 | ============ 4 | 5 | Contributions are welcome, and they are greatly appreciated! Every 6 | little bit helps, and credit will always be given. 7 | 8 | You can contribute in many ways: 9 | 10 | Types of Contributions 11 | ---------------------- 12 | 13 | Report Bugs 14 | ~~~~~~~~~~~ 15 | 16 | Report bugs at https://github.com/native2k/supervisor-serialrestart/issues. 17 | 18 | If you are reporting a bug, please include: 19 | 20 | * Your operating system name and version. 21 | * Any details about your local setup that might be helpful in troubleshooting. 22 | * Detailed steps to reproduce the bug. 23 | 24 | Fix Bugs 25 | ~~~~~~~~ 26 | 27 | Look through the GitHub issues for bugs. Anything tagged with "bug" 28 | is open to whoever wants to implement it. 29 | 30 | Implement Features 31 | ~~~~~~~~~~~~~~~~~~ 32 | 33 | Look through the GitHub issues for features. Anything tagged with "feature" 34 | is open to whoever wants to implement it. 35 | 36 | Submit Feedback 37 | ~~~~~~~~~~~~~~~ 38 | 39 | The best way to send feedback is to file an issue at https://github.com/native2k/supervisor-serialrestart/issues. 40 | 41 | If you are proposing a feature: 42 | 43 | * Explain in detail how it would work. 44 | * Keep the scope as narrow as possible, to make it easier to implement. 45 | * Remember that this is a volunteer-driven project, and that contributions 46 | are welcome :) 47 | 48 | Get Started! 49 | ------------ 50 | 51 | Ready to contribute? Here's how to set up `supervisor-serialrestart` for local development. 52 | 53 | 1. Fork the `supervisor-serialrestart` repo on GitHub. 54 | 2. Clone your fork locally:: 55 | 56 | $ git clone git@github.com:your_name_here/supervisor-serialrestart.git 57 | 58 | 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: 59 | 60 | $ mkvirtualenv supervisor-serialrestart 61 | $ cd supervisor-serialrestart/ 62 | $ python setup.py develop 63 | 64 | 4. Create a branch for local development:: 65 | 66 | $ git checkout -b name-of-your-bugfix-or-feature 67 | 68 | Now you can make your changes locally. 69 | 70 | 5. When you're done making changes, check that your changes pass flake8 and the 71 | tests, including testing other Python versions with tox:: 72 | 73 | $ flake8 supervisorserialrestart tests 74 | $ python setup.py test 75 | $ tox 76 | 77 | To get flake8 and tox, just pip install them into your virtualenv. 78 | 79 | 6. Commit your changes and push your branch to GitHub:: 80 | 81 | $ git add . 82 | $ git commit -m "Your detailed description of your changes." 83 | $ git push origin name-of-your-bugfix-or-feature 84 | 85 | 7. Submit a pull request through the GitHub website. 86 | 87 | Pull Request Guidelines 88 | ----------------------- 89 | 90 | Before you submit a pull request, check that it meets these guidelines: 91 | 92 | 1. The pull request should include tests. 93 | 2. If the pull request adds functionality, the docs should be updated. Put 94 | your new functionality into a function with a docstring, and add the 95 | feature to the list in README.rst. 96 | 3. The pull request should work for Python 2.6, and 2.7 and for PyPy. Check 97 | https://travis-ci.org/native2k/supervisor-serialrestart/pull_requests 98 | and make sure that the tests pass for all supported Python versions. 99 | 100 | Tips 101 | ---- 102 | 103 | To run a subset of tests:: 104 | 105 | $ python -m unittest tests.test_supervisor-serialrestart -------------------------------------------------------------------------------- /DESCRIPTION.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | Supervisor serialrestart 3 | =============================== 4 | 5 | .. image:: https://badge.fury.io/py/supervisor-serialrestart.png 6 | :target: http://badge.fury.io/py/supervisor-serialrestart 7 | 8 | .. image:: https://pypip.in/d/supervisor-serialrestart/badge.png 9 | :target: https://crate.io/packages/supervisor-serialrestart?version=latest 10 | 11 | 12 | Adds ``serialrestart`` command to Supervisor_. This command works 13 | simmilar to restart but if you have multiple services, it sometimes is 14 | preferable to restart them one after another to minimize downtime. 15 | 16 | It even supports wildcards. 17 | 18 | * Free software: BSD license 19 | * Documentation: http://supervisor-serialrestart.rtfd.org. 20 | 21 | .. _Supervisor: http://supervisord.org/ -------------------------------------------------------------------------------- /HISTORY.rst: -------------------------------------------------------------------------------- 1 | .. :changelog: 2 | 3 | History 4 | ------- 5 | 6 | * 0.1.1 (2013-10-29) 7 | * just fixed documentation/project structure 8 | 9 | * 0.1.0 (2013-10-16) 10 | * First release on PyPI. -------------------------------------------------------------------------------- /INSTALLATION.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Installation 3 | ============ 4 | 5 | At the command line:: 6 | 7 | $ easy_install supervisor-serialrestart 8 | 9 | Or:: 10 | 11 | $ pip install supervisor-serialrestart 12 | 13 | 14 | And then add into your supervisor.conf:: 15 | 16 | [ctlplugin:serialrestart] 17 | supervisor.ctl_factory = supervisorserialrestart.controllerplugin:make_serialrestart_controllerplugin 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Sven Richter 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | * Neither the name of Blubber Bernd bullhsit bingo daemon nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS.rst 2 | include CONTRIBUTING.rst 3 | include HISTORY.rst 4 | include LICENSE 5 | include DESCRIPTION.rst 6 | include INSTALLATION.rst 7 | include USAGE.rst 8 | include README.rst 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean-pyc clean-build docs 2 | 3 | help: 4 | @echo "clean-build - remove build artifacts" 5 | @echo "clean-pyc - remove Python file artifacts" 6 | @echo "lint - check style with flake8" 7 | @echo "test - run tests quickly with the default Python" 8 | @echo "testall - run tests on every Python version with tox" 9 | @echo "coverage - check code coverage quickly with the default Python" 10 | @echo "docs - generate Sphinx HTML documentation, including API docs" 11 | @echo "release - package and upload a release" 12 | @echo "sdist - package" 13 | 14 | clean: clean-build clean-pyc 15 | 16 | clean-build: 17 | rm -fr build/ 18 | rm -fr dist/ 19 | rm -fr *.egg-info 20 | 21 | clean-pyc: 22 | find . -name '*.pyc' -exec rm -f {} + 23 | find . -name '*.pyo' -exec rm -f {} + 24 | find . -name '*~' -exec rm -f {} + 25 | 26 | lint: 27 | flake8 supervisorserialrestart tests 28 | 29 | test: 30 | python setup.py test 31 | 32 | testall: 33 | tox 34 | 35 | coverage: 36 | coverage run --source supervisorserialrestart setup.py test 37 | coverage report -m 38 | coverage html 39 | # open htmlcov/index.html 40 | 41 | docs: 42 | cat DESCRIPTION.rst USAGE.rst INSTALLATION.rst HISTORY.rst > README.rst 43 | rm -f docs/supervisorserialrestart.rst 44 | rm -f docs/modules.rst 45 | sphinx-apidoc -o docs/ supervisorserialrestart 46 | $(MAKE) -C docs clean 47 | $(MAKE) -C docs html 48 | # open docs/_build/html/index.html 49 | 50 | release: clean docs 51 | python setup.py sdist upload 52 | 53 | sdist: clean 54 | python setup.py sdist 55 | ls -l dist -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | =============================== 2 | Supervisor serialrestart 3 | =============================== 4 | 5 | .. image:: https://badge.fury.io/py/supervisor-serialrestart.png 6 | :target: http://badge.fury.io/py/supervisor-serialrestart 7 | 8 | .. image:: https://pypip.in/d/supervisor-serialrestart/badge.png 9 | :target: https://crate.io/packages/supervisor-serialrestart?version=latest 10 | 11 | 12 | Adds ``serialrestart`` command to Supervisor_. This command works 13 | simmilar to restart but if you have multiple services, it sometimes is 14 | preferable to restart them one after another to minimize downtime. 15 | 16 | It even supports wildcards. 17 | 18 | * Free software: BSD license 19 | * Documentation: http://supervisor-serialrestart.rtfd.org. 20 | 21 | .. _Supervisor: http://supervisord.org/Usage 22 | ----- 23 | 24 | :: 25 | 26 | supervisor> status 27 | baz:bar RUNNING 28 | baz:foo RUNNING 29 | one RUNNING 30 | 31 | supervisor> serialrestart all 32 | baz:bar: stopped 33 | baz:bar: started 34 | baz:foo: stopped 35 | baz:foo: started 36 | one: stopped 37 | one: started 38 | 39 | supervisor> serialrestart baz:* 40 | baz:bar: stopped 41 | baz:bar: started 42 | baz:foo: stopped 43 | baz:foo: started 44 | 45 | $supervisor> serialrestart baz:b* 46 | baz:bar: stopped 47 | baz:bar: started 48 | 49 | 50 | ============ 51 | Installation 52 | ============ 53 | 54 | At the command line:: 55 | 56 | $ easy_install supervisor-serialrestart 57 | 58 | Or:: 59 | 60 | $ pip install supervisor-serialrestart 61 | 62 | 63 | And then add into your supervisor.conf:: 64 | 65 | [ctlplugin:serialrestart] 66 | supervisor.ctl_factory = supervisorserialrestart.controllerplugin:make_serialrestart_controllerplugin 67 | 68 | .. :changelog: 69 | 70 | History 71 | ------- 72 | 73 | * 0.1.1 (2013-10-29) 74 | * just fixed documentation/project structure 75 | 76 | * 0.1.0 (2013-10-16) 77 | * First release on PyPI. -------------------------------------------------------------------------------- /USAGE.rst: -------------------------------------------------------------------------------- 1 | Usage 2 | ----- 3 | 4 | :: 5 | 6 | supervisor> status 7 | baz:bar RUNNING 8 | baz:foo RUNNING 9 | one RUNNING 10 | 11 | supervisor> serialrestart all 12 | baz:bar: stopped 13 | baz:bar: started 14 | baz:foo: stopped 15 | baz:foo: started 16 | one: stopped 17 | one: started 18 | 19 | supervisor> serialrestart baz:* 20 | baz:bar: stopped 21 | baz:bar: started 22 | baz:foo: stopped 23 | baz:foo: started 24 | 25 | $supervisor> serialrestart baz:b* 26 | baz:bar: stopped 27 | baz:bar: started 28 | 29 | 30 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # User-friendly check for sphinx-build 11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) 12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) 13 | endif 14 | 15 | # Internal variables. 16 | PAPEROPT_a4 = -D latex_paper_size=a4 17 | PAPEROPT_letter = -D latex_paper_size=letter 18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 19 | # the i18n builder cannot share the environment and doctrees with the others 20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 21 | 22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 23 | 24 | help: 25 | @echo "Please use \`make ' where is one of" 26 | @echo " html to make standalone HTML files" 27 | @echo " dirhtml to make HTML files named index.html in directories" 28 | @echo " singlehtml to make a single large HTML file" 29 | @echo " pickle to make pickle files" 30 | @echo " json to make JSON files" 31 | @echo " htmlhelp to make HTML files and a HTML help project" 32 | @echo " qthelp to make HTML files and a qthelp project" 33 | @echo " devhelp to make HTML files and a Devhelp project" 34 | @echo " epub to make an epub" 35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 36 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" 38 | @echo " text to make text files" 39 | @echo " man to make manual pages" 40 | @echo " texinfo to make Texinfo files" 41 | @echo " info to make Texinfo files and run them through makeinfo" 42 | @echo " gettext to make PO message catalogs" 43 | @echo " changes to make an overview of all changed/added/deprecated items" 44 | @echo " xml to make Docutils-native XML files" 45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes" 46 | @echo " linkcheck to check all external links for integrity" 47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 48 | 49 | clean: 50 | rm -rf $(BUILDDIR)/* 51 | 52 | html: 53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 54 | @echo 55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 56 | 57 | dirhtml: 58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 59 | @echo 60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 61 | 62 | singlehtml: 63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 64 | @echo 65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 66 | 67 | pickle: 68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 69 | @echo 70 | @echo "Build finished; now you can process the pickle files." 71 | 72 | json: 73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 74 | @echo 75 | @echo "Build finished; now you can process the JSON files." 76 | 77 | htmlhelp: 78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 79 | @echo 80 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 81 | ".hhp project file in $(BUILDDIR)/htmlhelp." 82 | 83 | qthelp: 84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 85 | @echo 86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/complexity.qhcp" 89 | @echo "To view the help file:" 90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/complexity.qhc" 91 | 92 | devhelp: 93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 94 | @echo 95 | @echo "Build finished." 96 | @echo "To view the help file:" 97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/complexity" 98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/complexity" 99 | @echo "# devhelp" 100 | 101 | epub: 102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 103 | @echo 104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 105 | 106 | latex: 107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 108 | @echo 109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 111 | "(use \`make latexpdf' here to do that automatically)." 112 | 113 | latexpdf: 114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 115 | @echo "Running LaTeX files through pdflatex..." 116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 118 | 119 | latexpdfja: 120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 121 | @echo "Running LaTeX files through platex and dvipdfmx..." 122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja 123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 124 | 125 | text: 126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 127 | @echo 128 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 129 | 130 | man: 131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 132 | @echo 133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 134 | 135 | texinfo: 136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 137 | @echo 138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 139 | @echo "Run \`make' in that directory to run these through makeinfo" \ 140 | "(use \`make info' here to do that automatically)." 141 | 142 | info: 143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 144 | @echo "Running Texinfo files through makeinfo..." 145 | make -C $(BUILDDIR)/texinfo info 146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 147 | 148 | gettext: 149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 150 | @echo 151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 152 | 153 | changes: 154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 155 | @echo 156 | @echo "The overview file is in $(BUILDDIR)/changes." 157 | 158 | linkcheck: 159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 160 | @echo 161 | @echo "Link check complete; look for any errors in the above output " \ 162 | "or in $(BUILDDIR)/linkcheck/output.txt." 163 | 164 | doctest: 165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 166 | @echo "Testing of doctests in the sources finished, look at the " \ 167 | "results in $(BUILDDIR)/doctest/output.txt." 168 | 169 | xml: 170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml 171 | @echo 172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml." 173 | 174 | pseudoxml: 175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml 176 | @echo 177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." -------------------------------------------------------------------------------- /docs/authors.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../AUTHORS.rst -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # complexity documentation build configuration file, created by 5 | # sphinx-quickstart on Tue Jul 9 22:26:36 2013. 6 | # 7 | # This file is execfile()d with the current directory set to its containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import sys, os 16 | 17 | # If extensions (or modules to document with autodoc) are in another directory, 18 | # add these directories to sys.path here. If the directory is relative to the 19 | # documentation root, use os.path.abspath to make it absolute, like shown here. 20 | #sys.path.insert(0, os.path.abspath('.')) 21 | 22 | # Get the project root dir, which is the parent dir of this 23 | cwd = os.getcwd() 24 | project_root = os.path.dirname(cwd) 25 | 26 | # Insert the project root dir as the first element in the PYTHONPATH. 27 | # This lets us ensure that the source package is imported, and that its 28 | # version is used. 29 | sys.path.insert(0, project_root) 30 | 31 | import supervisorserialrestart 32 | 33 | # -- General configuration ----------------------------------------------------- 34 | 35 | # If your documentation needs a minimal Sphinx version, state it here. 36 | #needs_sphinx = '1.0' 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be extensions 39 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 40 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] 41 | 42 | # Add any paths that contain templates here, relative to this directory. 43 | templates_path = ['_templates'] 44 | 45 | # The suffix of source filenames. 46 | source_suffix = '.rst' 47 | 48 | # The encoding of source files. 49 | #source_encoding = 'utf-8-sig' 50 | 51 | # The master toctree document. 52 | master_doc = 'index' 53 | 54 | # General information about the project. 55 | project = u'supervisorctl-serialrestart' 56 | copyright = u'2013, Sven Richter' 57 | 58 | # The version info for the project you're documenting, acts as replacement for 59 | # |version| and |release|, also used in various other places throughout the 60 | # built documents. 61 | # 62 | # The short X.Y version. 63 | version = supervisorserialrestart.__version__ 64 | # The full version, including alpha/beta/rc tags. 65 | release = supervisorserialrestart.__version__ 66 | 67 | # The language for content autogenerated by Sphinx. Refer to documentation 68 | # for a list of supported languages. 69 | #language = None 70 | 71 | # There are two options for replacing |today|: either, you set today to some 72 | # non-false value, then it is used: 73 | #today = '' 74 | # Else, today_fmt is used as the format for a strftime call. 75 | #today_fmt = '%B %d, %Y' 76 | 77 | # List of patterns, relative to source directory, that match files and 78 | # directories to ignore when looking for source files. 79 | exclude_patterns = ['_build'] 80 | 81 | # The reST default role (used for this markup: `text`) to use for all documents. 82 | #default_role = None 83 | 84 | # If true, '()' will be appended to :func: etc. cross-reference text. 85 | #add_function_parentheses = True 86 | 87 | # If true, the current module name will be prepended to all description 88 | # unit titles (such as .. function::). 89 | #add_module_names = True 90 | 91 | # If true, sectionauthor and moduleauthor directives will be shown in the 92 | # output. They are ignored by default. 93 | #show_authors = False 94 | 95 | # The name of the Pygments (syntax highlighting) style to use. 96 | pygments_style = 'sphinx' 97 | 98 | # A list of ignored prefixes for module index sorting. 99 | #modindex_common_prefix = [] 100 | 101 | # If true, keep warnings as "system message" paragraphs in the built documents. 102 | #keep_warnings = False 103 | 104 | 105 | # -- Options for HTML output --------------------------------------------------- 106 | 107 | # The theme to use for HTML and HTML Help pages. See the documentation for 108 | # a list of builtin themes. 109 | html_theme = 'default' 110 | 111 | # Theme options are theme-specific and customize the look and feel of a theme 112 | # further. For a list of options available for each theme, see the 113 | # documentation. 114 | #html_theme_options = {} 115 | 116 | # Add any paths that contain custom themes here, relative to this directory. 117 | #html_theme_path = [] 118 | 119 | # The name for this set of Sphinx documents. If None, it defaults to 120 | # " v documentation". 121 | #html_title = None 122 | 123 | # A shorter title for the navigation bar. Default is the same as html_title. 124 | #html_short_title = None 125 | 126 | # The name of an image file (relative to this directory) to place at the top 127 | # of the sidebar. 128 | #html_logo = None 129 | 130 | # The name of an image file (within the static path) to use as favicon of the 131 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 132 | # pixels large. 133 | #html_favicon = None 134 | 135 | # Add any paths that contain custom static files (such as style sheets) here, 136 | # relative to this directory. They are copied after the builtin static files, 137 | # so a file named "default.css" will overwrite the builtin "default.css". 138 | html_static_path = ['_static'] 139 | 140 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 141 | # using the given strftime format. 142 | #html_last_updated_fmt = '%b %d, %Y' 143 | 144 | # If true, SmartyPants will be used to convert quotes and dashes to 145 | # typographically correct entities. 146 | #html_use_smartypants = True 147 | 148 | # Custom sidebar templates, maps document names to template names. 149 | #html_sidebars = {} 150 | 151 | # Additional templates that should be rendered to pages, maps page names to 152 | # template names. 153 | #html_additional_pages = {} 154 | 155 | # If false, no module index is generated. 156 | #html_domain_indices = True 157 | 158 | # If false, no index is generated. 159 | #html_use_index = True 160 | 161 | # If true, the index is split into individual pages for each letter. 162 | #html_split_index = False 163 | 164 | # If true, links to the reST sources are added to the pages. 165 | #html_show_sourcelink = True 166 | 167 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 168 | #html_show_sphinx = True 169 | 170 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 171 | #html_show_copyright = True 172 | 173 | # If true, an OpenSearch description file will be output, and all pages will 174 | # contain a tag referring to it. The value of this option must be the 175 | # base URL from which the finished HTML is served. 176 | #html_use_opensearch = '' 177 | 178 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 179 | #html_file_suffix = None 180 | 181 | # Output file base name for HTML help builder. 182 | htmlhelp_basename = 'supervisorserialrestartdoc' 183 | 184 | 185 | # -- Options for LaTeX output -------------------------------------------------- 186 | 187 | latex_elements = { 188 | # The paper size ('letterpaper' or 'a4paper'). 189 | #'papersize': 'letterpaper', 190 | 191 | # The font size ('10pt', '11pt' or '12pt'). 192 | #'pointsize': '10pt', 193 | 194 | # Additional stuff for the LaTeX preamble. 195 | #'preamble': '', 196 | } 197 | 198 | # Grouping the document tree into LaTeX files. List of tuples 199 | # (source start file, target name, title, author, documentclass [howto/manual]). 200 | latex_documents = [ 201 | ('index', 'supervisorserialrestart.tex', u'supervisorctl-serialrestart Documentation', 202 | u'Sven Richter', 'manual'), 203 | ] 204 | 205 | # The name of an image file (relative to this directory) to place at the top of 206 | # the title page. 207 | #latex_logo = None 208 | 209 | # For "manual" documents, if this is true, then toplevel headings are parts, 210 | # not chapters. 211 | #latex_use_parts = False 212 | 213 | # If true, show page references after internal links. 214 | #latex_show_pagerefs = False 215 | 216 | # If true, show URL addresses after external links. 217 | #latex_show_urls = False 218 | 219 | # Documents to append as an appendix to all manuals. 220 | #latex_appendices = [] 221 | 222 | # If false, no module index is generated. 223 | #latex_domain_indices = True 224 | 225 | 226 | # -- Options for manual page output -------------------------------------------- 227 | 228 | # One entry per manual page. List of tuples 229 | # (source start file, name, description, authors, manual section). 230 | man_pages = [ 231 | ('index', 'supervisorserialrestart', u'supervisorctl-serialrestart Documentation', 232 | [u'Sven Richter'], 1) 233 | ] 234 | 235 | # If true, show URL addresses after external links. 236 | #man_show_urls = False 237 | 238 | 239 | # -- Options for Texinfo output ------------------------------------------------ 240 | 241 | # Grouping the document tree into Texinfo files. List of tuples 242 | # (source start file, target name, title, author, 243 | # dir menu entry, description, category) 244 | texinfo_documents = [ 245 | ('index', 'supervisorserialrestart', u'supervisorctl-serialrestart Documentation', 246 | u'Sven Richter', 'supervisorserialrestart', 'One line description of project.', 247 | 'Miscellaneous'), 248 | ] 249 | 250 | # Documents to append as an appendix to all manuals. 251 | #texinfo_appendices = [] 252 | 253 | # If false, no module index is generated. 254 | #texinfo_domain_indices = True 255 | 256 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 257 | #texinfo_show_urls = 'footnote' 258 | 259 | # If true, do not generate a @detailmenu in the "Top" node's menu. 260 | #texinfo_no_detailmenu = False -------------------------------------------------------------------------------- /docs/contributing.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../CONTRIBUTING.rst -------------------------------------------------------------------------------- /docs/description.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../DESCRIPTION.rst -------------------------------------------------------------------------------- /docs/history.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../HISTORY.rst -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. complexity documentation master file, created by 2 | sphinx-quickstart on Tue Jul 9 22:26:36 2013. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to supervisorctl-serialrestart's documentation! 7 | ====================================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | description 15 | installation 16 | usage 17 | contributing 18 | authors 19 | history 20 | 21 | Indices and tables 22 | ================== 23 | 24 | * :ref:`genindex` 25 | * :ref:`modindex` 26 | * :ref:`search` 27 | -------------------------------------------------------------------------------- /docs/installation.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../INSTALLATION.rst -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=_build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 10 | set I18NSPHINXOPTS=%SPHINXOPTS% . 11 | if NOT "%PAPER%" == "" ( 12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% 14 | ) 15 | 16 | if "%1" == "" goto help 17 | 18 | if "%1" == "help" ( 19 | :help 20 | echo.Please use `make ^` where ^ is one of 21 | echo. html to make standalone HTML files 22 | echo. dirhtml to make HTML files named index.html in directories 23 | echo. singlehtml to make a single large HTML file 24 | echo. pickle to make pickle files 25 | echo. json to make JSON files 26 | echo. htmlhelp to make HTML files and a HTML help project 27 | echo. qthelp to make HTML files and a qthelp project 28 | echo. devhelp to make HTML files and a Devhelp project 29 | echo. epub to make an epub 30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 31 | echo. text to make text files 32 | echo. man to make manual pages 33 | echo. texinfo to make Texinfo files 34 | echo. gettext to make PO message catalogs 35 | echo. changes to make an overview over all changed/added/deprecated items 36 | echo. xml to make Docutils-native XML files 37 | echo. pseudoxml to make pseudoxml-XML files for display purposes 38 | echo. linkcheck to check all external links for integrity 39 | echo. doctest to run all doctests embedded in the documentation if enabled 40 | goto end 41 | ) 42 | 43 | if "%1" == "clean" ( 44 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 45 | del /q /s %BUILDDIR%\* 46 | goto end 47 | ) 48 | 49 | 50 | %SPHINXBUILD% 2> nul 51 | if errorlevel 9009 ( 52 | echo. 53 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 54 | echo.installed, then set the SPHINXBUILD environment variable to point 55 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 56 | echo.may add the Sphinx directory to PATH. 57 | echo. 58 | echo.If you don't have Sphinx installed, grab it from 59 | echo.http://sphinx-doc.org/ 60 | exit /b 1 61 | ) 62 | 63 | if "%1" == "html" ( 64 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 65 | if errorlevel 1 exit /b 1 66 | echo. 67 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 68 | goto end 69 | ) 70 | 71 | if "%1" == "dirhtml" ( 72 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 73 | if errorlevel 1 exit /b 1 74 | echo. 75 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 76 | goto end 77 | ) 78 | 79 | if "%1" == "singlehtml" ( 80 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 81 | if errorlevel 1 exit /b 1 82 | echo. 83 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 84 | goto end 85 | ) 86 | 87 | if "%1" == "pickle" ( 88 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 89 | if errorlevel 1 exit /b 1 90 | echo. 91 | echo.Build finished; now you can process the pickle files. 92 | goto end 93 | ) 94 | 95 | if "%1" == "json" ( 96 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 97 | if errorlevel 1 exit /b 1 98 | echo. 99 | echo.Build finished; now you can process the JSON files. 100 | goto end 101 | ) 102 | 103 | if "%1" == "htmlhelp" ( 104 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 105 | if errorlevel 1 exit /b 1 106 | echo. 107 | echo.Build finished; now you can run HTML Help Workshop with the ^ 108 | .hhp project file in %BUILDDIR%/htmlhelp. 109 | goto end 110 | ) 111 | 112 | if "%1" == "qthelp" ( 113 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 114 | if errorlevel 1 exit /b 1 115 | echo. 116 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 117 | .qhcp project file in %BUILDDIR%/qthelp, like this: 118 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\complexity.qhcp 119 | echo.To view the help file: 120 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\complexity.ghc 121 | goto end 122 | ) 123 | 124 | if "%1" == "devhelp" ( 125 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 126 | if errorlevel 1 exit /b 1 127 | echo. 128 | echo.Build finished. 129 | goto end 130 | ) 131 | 132 | if "%1" == "epub" ( 133 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 134 | if errorlevel 1 exit /b 1 135 | echo. 136 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 137 | goto end 138 | ) 139 | 140 | if "%1" == "latex" ( 141 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 142 | if errorlevel 1 exit /b 1 143 | echo. 144 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 145 | goto end 146 | ) 147 | 148 | if "%1" == "latexpdf" ( 149 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 150 | cd %BUILDDIR%/latex 151 | make all-pdf 152 | cd %BUILDDIR%/.. 153 | echo. 154 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 155 | goto end 156 | ) 157 | 158 | if "%1" == "latexpdfja" ( 159 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 160 | cd %BUILDDIR%/latex 161 | make all-pdf-ja 162 | cd %BUILDDIR%/.. 163 | echo. 164 | echo.Build finished; the PDF files are in %BUILDDIR%/latex. 165 | goto end 166 | ) 167 | 168 | if "%1" == "text" ( 169 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 170 | if errorlevel 1 exit /b 1 171 | echo. 172 | echo.Build finished. The text files are in %BUILDDIR%/text. 173 | goto end 174 | ) 175 | 176 | if "%1" == "man" ( 177 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 178 | if errorlevel 1 exit /b 1 179 | echo. 180 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 181 | goto end 182 | ) 183 | 184 | if "%1" == "texinfo" ( 185 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo 186 | if errorlevel 1 exit /b 1 187 | echo. 188 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. 189 | goto end 190 | ) 191 | 192 | if "%1" == "gettext" ( 193 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale 194 | if errorlevel 1 exit /b 1 195 | echo. 196 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale. 197 | goto end 198 | ) 199 | 200 | if "%1" == "changes" ( 201 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 202 | if errorlevel 1 exit /b 1 203 | echo. 204 | echo.The overview file is in %BUILDDIR%/changes. 205 | goto end 206 | ) 207 | 208 | if "%1" == "linkcheck" ( 209 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 210 | if errorlevel 1 exit /b 1 211 | echo. 212 | echo.Link check complete; look for any errors in the above output ^ 213 | or in %BUILDDIR%/linkcheck/output.txt. 214 | goto end 215 | ) 216 | 217 | if "%1" == "doctest" ( 218 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 219 | if errorlevel 1 exit /b 1 220 | echo. 221 | echo.Testing of doctests in the sources finished, look at the ^ 222 | results in %BUILDDIR%/doctest/output.txt. 223 | goto end 224 | ) 225 | 226 | if "%1" == "xml" ( 227 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml 228 | if errorlevel 1 exit /b 1 229 | echo. 230 | echo.Build finished. The XML files are in %BUILDDIR%/xml. 231 | goto end 232 | ) 233 | 234 | if "%1" == "pseudoxml" ( 235 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml 236 | if errorlevel 1 exit /b 1 237 | echo. 238 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. 239 | goto end 240 | ) 241 | 242 | :end -------------------------------------------------------------------------------- /docs/usage.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../USAGE.rst -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # for running tests 2 | supervisor 3 | nose 4 | coverage 5 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import os 5 | import sys 6 | 7 | py_version = sys.version_info[:2] 8 | 9 | if py_version < (2, 6): 10 | raise RuntimeError( 11 | 'On Python 2, supervisor-serialrestart requires Python 2.6 or later') 12 | elif (3, 0) < py_version < (3, 2): 13 | raise RuntimeError( 14 | 'On Python 3, supervisor-serialrestart requires Python 3.2 or later') 15 | 16 | try: 17 | from setuptools import setup 18 | except ImportError: 19 | from distutils.core import setup 20 | 21 | if sys.argv[-1] == 'publish': 22 | os.system('python setup.py sdist upload') 23 | sys.exit() 24 | 25 | readme = open('README.rst').read() 26 | #history = open('HISTORY.rst').read().replace('.. :changelog:', '') 27 | 28 | setup( 29 | name='supervisor-serialrestart', 30 | version='0.1.1', 31 | description='Adds serialrestart command to Supervisor.', 32 | long_description=readme, 33 | author='Sven Richter', 34 | author_email='native2k@gmail.com', 35 | url='https://github.com/native2k/supervisor-serialrestart', 36 | packages=[ 37 | 'supervisorserialrestart', 38 | ], 39 | package_dir={'supervisorserialrestart': 'supervisorserialrestart'}, 40 | include_package_data=True, 41 | install_requires=[ 42 | ], 43 | license="BSD", 44 | zip_safe=False, 45 | keywords='supervisorserialrestart supervisor-serialrestart supervisor serialrestart', 46 | classifiers=[ 47 | 'Development Status :: 2 - Pre-Alpha', 48 | 'Intended Audience :: Developers', 49 | 'License :: OSI Approved :: BSD License', 50 | 'Natural Language :: English', 51 | "Programming Language :: Python :: 2", 52 | 'Programming Language :: Python :: 2.6', 53 | 'Programming Language :: Python :: 2.7', 54 | 'Programming Language :: Python :: 3', 55 | 'Programming Language :: Python :: 3.2', 56 | 'Programming Language :: Python :: 3.3', 57 | ], 58 | test_suite='tests.run_tests.run_all', 59 | ) -------------------------------------------------------------------------------- /supervisorserialrestart/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | __author__ = 'Sven Richter' 5 | __email__ = 'native2k@gmail.com' 6 | __version__ = '0.1.1' 7 | -------------------------------------------------------------------------------- /supervisorserialrestart/controllerplugin.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from supervisor.supervisorctl import ControllerPluginBase 3 | import fnmatch 4 | 5 | 6 | class SerialRestartControllerPlugin(ControllerPluginBase): 7 | name = 'serialrestart' 8 | 9 | def __init__(self, controller, **config): 10 | self.ctl = controller 11 | self.match_group = bool(int(config.get('match_group', '0'))) 12 | 13 | def _procrepr(self, process): 14 | template = '%(group)s:%(name)s' 15 | if process['group'] == process['name']: 16 | return process['name'] 17 | else: 18 | return template % process 19 | 20 | def do_serialrestart(self, arg): 21 | if not self.ctl.upcheck(): 22 | return 23 | 24 | names = arg.strip().split() 25 | supervisor = self.ctl.get_supervisor() 26 | 27 | if not names: 28 | self.ctl.output('Error: serialrestart requires a process name') 29 | self.help_serialrestart() 30 | return 31 | 32 | # first get all process to handle 33 | processes = set() 34 | 35 | allprocesses = [self._procrepr(p) for p in supervisor.getAllProcessInfo()] 36 | if 'all' in names: 37 | processes = allprocesses 38 | else: 39 | for name in names: 40 | match = [p for p in allprocesses if fnmatch.fnmatch(p, name)] 41 | if match: 42 | processes = processes.union(match) 43 | else: 44 | self.ctl.output('No such process %s' % (name, )) 45 | 46 | # do restart for each of them 47 | for process in processes: 48 | self.ctl.onecmd('restart %s' % process) 49 | 50 | def help_serialrestart(self): 51 | self.ctl.output("serialrestart \t\tRestart a process") 52 | self.ctl.output("serialrestart :*\tRestart all processes in a group") 53 | self.ctl.output("serialrestart \tRestart multiple processes or " 54 | "groups") 55 | self.ctl.output("serialrestart all\t\tRestart all processes") 56 | self.ctl.output("Note: serialrestart does restart one process after another, " 57 | "instead of restart, which stops all process and then starts them.") 58 | self.ctl.output("Note: serialrestart does not reread config files. For that," 59 | " see reread and update.") 60 | self.ctl.output("Note: serialrestart also accepts wildcard expressions to match the process name") 61 | self.ctl.output("serialrestart a* restarts all processes begining with \"a\"") 62 | 63 | 64 | def make_serialrestart_controllerplugin(controller, **config): 65 | return SerialRestartControllerPlugin(controller, **config) 66 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | from os.path import dirname, join 2 | import subprocess 3 | import time 4 | 5 | 6 | _supervisor_processes = [] 7 | 8 | 9 | def setUp(): 10 | if not _supervisor_processes: 11 | _supervisor_processes.append( 12 | subprocess.Popen(['supervisord', '-n', '--configuration', join(dirname(__file__), 'supervisord.conf')]) 13 | ) 14 | time.sleep(3) 15 | 16 | 17 | def tearDown(): 18 | for process in _supervisor_processes: 19 | process.kill() 20 | for process in _supervisor_processes: 21 | process.wait() 22 | -------------------------------------------------------------------------------- /tests/run_tests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | simple shortcut for running nosetests via python 4 | replacement for *.bat or *.sh wrappers 5 | ''' 6 | 7 | import sys 8 | from os import path 9 | 10 | import nose 11 | 12 | 13 | def run_all(argv=None): 14 | 15 | if argv is None: 16 | argv = [ 17 | 'nosetests', 18 | '--with-coverage', '--cover-package=supervisorwildcards', '--cover-erase', 19 | '--nocapture', '--nologcapture', '--verbose', 20 | ] 21 | else: 22 | for p in ('--with-coverage', '--cover-package=dashvisor', '--cover-erase'): 23 | if p not in argv: 24 | argv.append(p) 25 | 26 | nose.run_exit( 27 | argv=argv, 28 | defaultTest=path.abspath(path.dirname(__file__)) 29 | ) 30 | 31 | if __name__ == '__main__': 32 | run_all(sys.argv) 33 | -------------------------------------------------------------------------------- /tests/supervisord.conf: -------------------------------------------------------------------------------- 1 | ; supervisor config file 2 | 3 | [unix_http_server] 4 | file=./supervisor.sock 5 | chmod=0700 ; sockef file mode (default 0700) 6 | 7 | #[inet_http_server] 8 | #port = 127.0.0.1:9001 9 | #username = user 10 | #password = 123 11 | 12 | [supervisord] 13 | #logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) 14 | #pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) 15 | #childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) 16 | 17 | ; the below section must remain in the config file for RPC 18 | ; (supervisorctl/web interface) to work, additional interfaces may be 19 | ; added by defining them in separate rpcinterface: sections 20 | [rpcinterface:supervisor] 21 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 22 | 23 | [supervisorctl] 24 | serverurl=unix://./supervisor.sock 25 | 26 | [ctlplugin:serialrestart] 27 | supervisor.ctl_factory = supervisorserialrestart.controllerplugin:make_serialrestart_controllerplugin 28 | 29 | ; The [include] section can just contain the "files" setting. This 30 | ; setting can list multiple files (separated by whitespace or 31 | ; newlines). It can also contain wildcards. The filenames are 32 | ; interpreted as relative to this file. Included files *cannot* 33 | ; include files themselves. 34 | 35 | [program:foo] 36 | command=cat 37 | startsecs=0 38 | 39 | [program:bar] 40 | command=cat 41 | startsecs=0 42 | 43 | [program:one] 44 | command=cat 45 | startsecs=0 46 | 47 | [group:baz] 48 | programs=foo,bar -------------------------------------------------------------------------------- /tests/test_plugin.py: -------------------------------------------------------------------------------- 1 | from os.path import dirname, join 2 | from subprocess import PIPE, Popen 3 | from unittest import TestCase 4 | 5 | CONFIG_FILE = join(dirname(__file__), 'supervisord.conf') 6 | 7 | 8 | class TestPlugin(TestCase): 9 | 10 | def setUp(self): 11 | self._supervisorctl('start all') 12 | 13 | def _supervisorctl(self, cmd, config_file=CONFIG_FILE): 14 | c = 'supervisorctl --configuration="%s" %s' % (config_file, cmd) 15 | out = Popen(c, shell=True, stdout=PIPE).stdout.read().decode("utf-8") 16 | print(out) 17 | return out 18 | 19 | def test_serialrestart_empty(self): 20 | result = self._supervisorctl('serialrestart') 21 | lines = result.split('\n') 22 | self.assertEqual(lines[0], 23 | 'Error: serialrestart requires a process name') 24 | assert(len(lines) == 10) 25 | 26 | def test_serialrestart_fail(self): 27 | result = self._supervisorctl('serialrestart blub') 28 | self.assertEqual(result, 29 | 'No such process blub\n') 30 | 31 | def test_serialrestart_one(self): 32 | result = self._supervisorctl('serialrestart one') 33 | self.assertEqual(result, 34 | 'one: stopped\none: started\n') 35 | 36 | def test_serialrestart_multi(self): 37 | result = self._supervisorctl('serialrestart one baz:foo') 38 | self.assertEqual(result, 39 | 'baz:foo: stopped\nbaz:foo: started\n' 40 | 'one: stopped\none: started\n') 41 | 42 | def test_serialrestart_all(self): 43 | result = self._supervisorctl('serialrestart all') 44 | self.assertEqual(result, 45 | 'baz:bar: stopped\nbaz:bar: started\n' 46 | 'baz:foo: stopped\nbaz:foo: started\n' 47 | 'one: stopped\none: started\n') 48 | 49 | def test_serialrestart_wildcard(self): 50 | result = self._supervisorctl('serialrestart baz:*') 51 | self.assertEqual(result, 52 | 'baz:bar: stopped\nbaz:bar: started\n' 53 | 'baz:foo: stopped\nbaz:foo: started\n') 54 | 55 | def test_serialrestart_wildcard_one(self): 56 | result = self._supervisorctl('serialrestart baz:b*') 57 | self.assertEqual(result, 58 | 'baz:bar: stopped\nbaz:bar: started\n') 59 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py26, py27 3 | 4 | [testenv] 5 | setenv = 6 | PYTHONPATH = {toxinidir}:{toxinidir}/bbbbd 7 | commands = python setup.py test 8 | deps = 9 | -r{toxinidir}/requirements.txt 10 | 11 | [flake8] 12 | max-line-length=120 --------------------------------------------------------------------------------