{ "info": { "author": "Jason Corbett", "author_email": "", "bugtrack_url": null, "classifiers": [ "Environment :: Plugins", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2.7", "Topic :: System :: Boot :: Init" ], "description": "=======================================\n Priority Order Startup for Supervisor\n=======================================\n\nThe Problem\n===========\nThe problem can be seen in `supervisor bug 122`_. The priority order in supervisor does determine startup order, but\nwhen **autostart=true** supervisor doesn't wait for the previous process to be RUNNING in order to continue. What is\neven harder is having initialization scripts that need to exit before continuing. This software is meant to make\nthis one use case easier.\n\n.. _supervisor bug 122: https://github.com/Supervisor/supervisor/issues/122\n\nHow it works\n============\n\nThis is an event listener for supervisor. This means it is run by supervisor on startup and supervisor will send it\nmessages whenever a program reaches a particular process state. When configured it will wait till a supervisor\nsubprocess get's to the configured state, then starts the next process. The next process is determined by priority.\n\nCaveats\n=======\n\nThis does not solve every situation. If what you need is everything starting up one by one, then this will likely solve\nyour issue. If you need to mix and match which starts in parallel and which in serial (dependencies) this is probably\nnot what you want.\n\nThis does not start groups. It can start programs that are part of a group, but it won't directly start a group.\n\nConfiguration\n=============\n\nConfiguration requires several things. First you need to configure this software as a event listener::\n\n [eventlistener:inorder]\n command=/path/to/ordered-startup-listener\n autostart=true\n events=PROCESS_STATE\n\nThis is probably the only thing you want to autostart. It needs xml rpc api, so don't forget to configure that. A\nfull example is shown later.\n\nThere are 2 additional configurations that can be put in a *[program:* section. These are:\n\n **startinorder**\n This must be set to *true* in order to have the next process in the line to be started after this one.\n **startnextafter**\n This is optional and is defaulted to *RUNNING*. If you want the process to exit before continuing then set\n this to *EXITED* (this is useful for initialization scripts that have to finish before something else starts).\n This is case insensitive.\n\nExample\n=======\n\nThe following is an example of a supervisor configuration that starts one item after the next in priority order.\nThe order will be ping, sleep, ping2, and ping3. The ping jobs are configured to wait till they have exited before\nthe next job is started (this is commonly used for initialization scripts that need to complete before continuing).\n\nFirst **supervisord.conf**::\n\n [supervisord]\n nodaemon=true\n\n [inet_http_server]\n port=127.0.0.1:9001\n\n [supervisorctl]\n serverurl=http://127.0.0.1:9001\n\n [rpcinterface:supervisor]\n supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface\n\n [eventlistener:inorder]\n command=/path/to/ordered-startup-listener\n autostart=true\n events=PROCESS_STATE\n\n [include]\n files=supervisord.d/*.conf\n\nNext we will look at the jobs in the **supervisord.d** directory like **supervisord.d/ping.conf**::\n\n [program:ping]\n command=/sbin/ping -c1 www.google.com\n priority=100\n startsecs=0\n autorestart=false\n autostart=false\n startinorder=true\n startnextafter=exited\n\n**supervisord.d/ping2.conf**::\n\n [program:ping2]\n command=/sbin/ping -c1 www.google.com\n priority=200\n startsecs=0\n autorestart=false\n autostart=false\n startinorder=true\n startnextafter=exited\n\n**supervisord.d/ping3.conf**::\n\n [program:ping3]\n command=/sbin/ping -c1 www.google.com\n priority=400\n startsecs=0\n autorestart=false\n autostart=false\n startinorder=true\n startnextafter=exited\n\n**supervisord.d/sleep.conf**::\n\n [program:sleep]\n command=/bin/sleep 60\n priority=101\n startsecs=5\n autorestart=true\n autostart=false\n startinorder=true\n\nNotice how all of the *program:* sections have autostart=false. Finally let's look at the output of running\nsupervisord::\n\n 2016-10-08 12:15:22,014 INFO Increased RLIMIT_NOFILE limit to 1024\n 2016-10-08 12:15:22,015 INFO Included extra file \"/Users/jason.corbett/tmp/supervisor/supervisord.d/ping.conf\" during parsing\n 2016-10-08 12:15:22,015 INFO Included extra file \"/Users/jason.corbett/tmp/supervisor/supervisord.d/ping2.conf\" during parsing\n 2016-10-08 12:15:22,015 INFO Included extra file \"/Users/jason.corbett/tmp/supervisor/supervisord.d/ping3.conf\" during parsing\n 2016-10-08 12:15:22,015 INFO Included extra file \"/Users/jason.corbett/tmp/supervisor/supervisord.d/sleep.conf\" during parsing\n 2016-10-08 12:15:22,044 INFO RPC interface 'supervisor' initialized\n 2016-10-08 12:15:22,044 CRIT Server 'inet_http_server' running without any HTTP authentication checking\n 2016-10-08 12:15:22,045 INFO supervisord started with pid 39396\n 2016-10-08 12:15:23,050 INFO spawned: 'inorder' with pid 39402\n 2016-10-08 12:15:23,325 INFO spawned: 'ping' with pid 39403\n 2016-10-08 12:15:23,325 INFO success: ping entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)\n 2016-10-08 12:15:23,359 INFO exited: ping (exit status 0; expected)\n 2016-10-08 12:15:24,048 INFO success: inorder entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n 2016-10-08 12:15:24,052 INFO spawned: 'sleep' with pid 39404\n 2016-10-08 12:15:29,051 INFO success: sleep entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)\n 2016-10-08 12:15:29,055 INFO spawned: 'ping2' with pid 39410\n 2016-10-08 12:15:29,056 INFO success: ping2 entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)\n 2016-10-08 12:15:29,069 INFO exited: ping2 (exit status 0; expected)\n 2016-10-08 12:15:29,072 INFO spawned: 'ping3' with pid 39411\n 2016-10-08 12:15:29,072 INFO success: ping3 entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)\n 2016-10-08 12:15:29,084 INFO exited: ping3 (exit status 0; expected)\n 2016-10-08 12:16:24,059 INFO exited: sleep (exit status 0; expected)\n 2016-10-08 12:16:24,061 INFO spawned: 'sleep' with pid 39452\n 2016-10-08 12:16:29,059 INFO success: sleep entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)\n\nAll of the processes started in order. **ping2** started after sleep was *RUNNING* (influenced by startsecs). When\nsleep respawned it didn't restart the chain, it only goes through it once.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jasoncorbett/ordered-startup-supervisord", "keywords": "", "license": "Apache Software License v2", "maintainer": "", "maintainer_email": "", "name": "ordered-startup-supervisord", "package_url": "https://pypi.org/project/ordered-startup-supervisord/", "platform": "", "project_url": "https://pypi.org/project/ordered-startup-supervisord/", "project_urls": { "Homepage": "http://github.com/jasoncorbett/ordered-startup-supervisord" }, "release_url": "https://pypi.org/project/ordered-startup-supervisord/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "An event listener for supervisord that will start up items in order upon certain states.", "version": "1.0.3" }, "last_serial": 2388607, "releases": { "1.0.3": [ { "comment_text": "", "digests": { "md5": "ea44e12b7e2a9b1a66e9db44b0f76b33", "sha256": "aae3d4aeddb098d88dd1001652010761aba24328dbdfe5624e4a96d35cec1734" }, "downloads": -1, "filename": "ordered_startup_supervisord-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "ea44e12b7e2a9b1a66e9db44b0f76b33", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8626, "upload_time": "2016-10-08T18:50:09", "url": "https://files.pythonhosted.org/packages/c6/6b/e4be8933d4451d423d40d2cbc5f25f662d7b5c4d4c69356b35eca8c397b7/ordered_startup_supervisord-1.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "637646de88702ddc2157d6bf0abb139c", "sha256": "5d87f9b8918a9d389ec858cc4080358ec6aec7d45d7d300d56954af2c8eb3bfd" }, "downloads": -1, "filename": "ordered-startup-supervisord-1.0.3.tar.gz", "has_sig": false, "md5_digest": "637646de88702ddc2157d6bf0abb139c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5439, "upload_time": "2016-10-08T18:50:05", "url": "https://files.pythonhosted.org/packages/b4/42/fb765f76413cad2c3182ccafbcb7c3dcecaf159dee652bc2f146e66cd0e1/ordered-startup-supervisord-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ea44e12b7e2a9b1a66e9db44b0f76b33", "sha256": "aae3d4aeddb098d88dd1001652010761aba24328dbdfe5624e4a96d35cec1734" }, "downloads": -1, "filename": "ordered_startup_supervisord-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "ea44e12b7e2a9b1a66e9db44b0f76b33", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 8626, "upload_time": "2016-10-08T18:50:09", "url": "https://files.pythonhosted.org/packages/c6/6b/e4be8933d4451d423d40d2cbc5f25f662d7b5c4d4c69356b35eca8c397b7/ordered_startup_supervisord-1.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "637646de88702ddc2157d6bf0abb139c", "sha256": "5d87f9b8918a9d389ec858cc4080358ec6aec7d45d7d300d56954af2c8eb3bfd" }, "downloads": -1, "filename": "ordered-startup-supervisord-1.0.3.tar.gz", "has_sig": false, "md5_digest": "637646de88702ddc2157d6bf0abb139c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5439, "upload_time": "2016-10-08T18:50:05", "url": "https://files.pythonhosted.org/packages/b4/42/fb765f76413cad2c3182ccafbcb7c3dcecaf159dee652bc2f146e66cd0e1/ordered-startup-supervisord-1.0.3.tar.gz" } ] }