{ "info": { "author": "Tarek Ziade", "author_email": "tarek@ziade.org", "bugtrack_url": null, "classifiers": [ "Framework :: Buildout", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. contents::\n\n\nCode repository: http://svn.plone.org/svn/collective/buildout/plone.recipe.cluster/\n\nChange history\n**************\n\ntrunk (2008-08-11)\n==================\n\n - xxx [Ingeniweb]\n\n0.1.0 (unreleased)\n==================\n\n - Initial implementation of Linux daemon.\n [tarek]\n\n - Created recipe with ZopeSkel. \n [tarek]\n\nDetailed Documentation\n**********************\n\nSupported options\n=================\n\nThe recipe supports the following options:\n\ndebug\n default option is 0. When set to 1, allows tests to run\n on a non-blocking daemon.\n\nstart\n Multiline option. Each line is a command line that will be\n called by the daemon when it is called with the `start` option.\n The commands must return immediatly, because the daemon waits\n for it before it launches the next command.\n\n It is possible though, to push a command line in the background\n with the `background:` prefix.\n\nstop\n Multiline option. Each line is a command line that will be\n called by the daemon when it is called with the `stop` option.\n The commands must return immediatly, because the daemon waits\n for it before it launches the next command.\n\n It is possible to ask the daemon to kill a given process, by\n providing a `pid:value` command line. Where `value` is either\n a PID number, either a text files that contains a pid.\n\n The `background:` prefix is also available.\n\nrestart\n Multiline option. Each line is a command line that will be\n called by the daemon when it is called with the `restart` option.\n The commands must return immediatly, because the daemon waits\n for it before it launches the next command.\n\n It is possible to ask the daemon to kill a given process, by\n providing a `pid:value` command line. Where `value` is either\n a PID number, either a text files that contains a pid.\n\n The `background:` prefix is also available.\n\npid-file\n Defines the path to the PID file of the daemon.\n\nExample usage\n=============\n\nThe `cluster` recipe allows you to create composite commands for your \nbuildout. There are three commands:\n\n- start\n- stop\n- restart\n\nEach command is a variable with a list of commands to be\nrun. The recipe then launches:\n- a daemon under Linux based system\n- a NT service under Windows\n\nA typical usage for instance is to start zeo, zope and pound::\n\n [buildout]\n\n ...\n\n [cluster]\n recipe = plone.recipe.cluster\n\n poundctl = ${buildout:bin-directory}/pound -f ${buildout:directory}/parts/pound/etc/pound.cfg -c ${buildout:directory}/pound.pid\n\n \n start = \n ${buildout:bin-directory}/zeoserver start\n ${buildout:bin-directory}/instance start\n ${cluster:poundctl}\n \n stop = \n ${buildout:bin-directory}/zeoserver stop\n ${buildout:bin-directory}/instance stop\n pid:${buildout:directory}/pound.pid\n \n restart = \n ${buildout:bin-directory}/zeoserver restart\n ${buildout:bin-directory}/instance restart\n ${cluster:poundctl}\n\nLet's try this::\n\n >>> write('buildout.cfg',\n ... \"\"\"\n ... [buildout]\n ... parts = cluster\n ... index = http://pypi.python.org/simple\n ... [cluster]\n ... recipe = plone.recipe.cluster\n ... debug = 1\n ... start = \n ... background:${buildout:bin-directory}/script1 \n ... ${buildout:bin-directory}/script2 start\n ...\n ... stop = \n ... ${buildout:bin-directory}/script2 stop\n ... \n ... restart = \n ... background:${buildout:bin-directory}/script1 \n ... ${buildout:bin-directory}/script2 restart\n ...\n ... \"\"\")\n\nRunning the buildout gives us::\n\n >>> print system(buildout)\n Getting distribution for 'zc.recipe.egg'.\n Got zc.recipe.egg 1.0.0.\n Installing cluster.\n Generated script '/.../bin/cluster'.\n \n\nNow let's see the script that was created::\n\n >>> script = join(sample_buildout, 'bin', 'cluster')\n >>> print open(script).read()\n #!...python\n \n import sys\n sys.path[0:0] = [\n ...\n ]\n \n import plone.recipe.cluster.ctl\n \n if __name__ == '__main__':\n plone.recipe.cluster.ctl.main(...)\n \n\nLet's create false scripts::\n\n >>> script2 = join(sample_buildout, 'bin', 'script2')\n >>> f = open(script2, 'w')\n >>> f.write('echo script 2')\n >>> f.close()\n >>> import os\n >>> os.chmod(script2, 0770)\n \n >>> script1 = join(sample_buildout, 'bin', 'script1') \n >>> f = open(script1, 'w')\n >>> import sys\n >>> f.write(\"\"\"\\\n ... #!%s\n ... import time\n ... while 1:\n ... time.sleep(0.1)\n ... \"\"\" % sys.executable)\n >>> f.close()\n >>> os.chmod(script1, 0770)\n\nLet's try to execute it::\n\n >>> print system(script)\n usage: /sample-buildout/bin/cluster start|stop|restart|status\n \n\nLet's ask for the status::\n\n >>> print system('%s status' % script)\n Not running.\n\nAh right, let's start it !\n::\n\n >>> print system('%s start' % script)\n Cluster is starting...\n Running in background ...script1\n Background pid is ...\n Background subpid is ...\n Running ...script2 start\n script 2\n Child PIDs: ..., ...\n Started with pid ...\n Cluster is alive...\n \n\nLet's ask for the status::\n \n >>> print system('%s status' % script)\n Running.\n\nWe should not be able to start it twice::\n \n >>> print system('%s start' % script)\n \n Start aborded since pid file '...' exists.\n \n\nLet's stop it::\n\n >>> print system('%s stop' % script)\n \n Cluster is going down...\n \n\nLet's restart it::\n\n >>> print system('%s restart' % script)\n Could not stop, pid file 'cluster.pid' missing.\n \n\nOh right, it was stopped !\n\n\nContributors\n************\n\nTarek Ziade, Author\n\n\nDownload\n********", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://svn.plone.org/svn/collective/buildout/plone.recipe.cluster", "keywords": "zope2 buildout", "license": "ZPL", "maintainer": null, "maintainer_email": null, "name": "plone.recipe.cluster", "package_url": "https://pypi.org/project/plone.recipe.cluster/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/plone.recipe.cluster/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://svn.plone.org/svn/collective/buildout/plone.recipe.cluster" }, "release_url": "https://pypi.org/project/plone.recipe.cluster/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "ZC Buildout recipe for organizing startup scripts.", "version": "0.1.0" }, "last_serial": 796414, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e49fc70887da3c0d34421536c1daec8d", "sha256": "83578acadd2602afa7e9f768f5792cbc8bcd6f87d09ec6a8b72343be14efe9ac" }, "downloads": -1, "filename": "plone.recipe.cluster-0.1.0-py2.4.egg", "has_sig": false, "md5_digest": "e49fc70887da3c0d34421536c1daec8d", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 40063, "upload_time": "2008-08-11T09:40:05", "url": "https://files.pythonhosted.org/packages/a6/d5/6a76b7ebf0d3f366345f95f81603f11ed92d504f83859a6bf15b0a05fc44/plone.recipe.cluster-0.1.0-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "1c0ee12a8308970d8c4f3203641b3fd8", "sha256": "4230aec69c0a743aeef85be0f869fbfb29482974f18a7ed9860d060d3b791c70" }, "downloads": -1, "filename": "plone.recipe.cluster-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1c0ee12a8308970d8c4f3203641b3fd8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22000, "upload_time": "2008-08-11T09:40:05", "url": "https://files.pythonhosted.org/packages/3b/f6/989f1283e44dda28437aba97ada14e73f2a23f8fb8cf2fc99df6760c6817/plone.recipe.cluster-0.1.0.tar.gz" } ], "1.0.0rc1": [ { "comment_text": "", "digests": { "md5": "7366479a5c7d5cfe197c277b7068bcf7", "sha256": "80782a9a45ce6eea31a73d07773497697f67867ec3835f73daa6569285a39f8e" }, "downloads": -1, "filename": "plone.recipe.cluster-1.0.0rc1.tar.gz", "has_sig": false, "md5_digest": "7366479a5c7d5cfe197c277b7068bcf7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22014, "upload_time": "2010-03-18T17:26:20", "url": "https://files.pythonhosted.org/packages/f0/1c/d0d96e9f8852857e032527454d2a2c974b336e9c393efcf8b7a18d214431/plone.recipe.cluster-1.0.0rc1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e49fc70887da3c0d34421536c1daec8d", "sha256": "83578acadd2602afa7e9f768f5792cbc8bcd6f87d09ec6a8b72343be14efe9ac" }, "downloads": -1, "filename": "plone.recipe.cluster-0.1.0-py2.4.egg", "has_sig": false, "md5_digest": "e49fc70887da3c0d34421536c1daec8d", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 40063, "upload_time": "2008-08-11T09:40:05", "url": "https://files.pythonhosted.org/packages/a6/d5/6a76b7ebf0d3f366345f95f81603f11ed92d504f83859a6bf15b0a05fc44/plone.recipe.cluster-0.1.0-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "1c0ee12a8308970d8c4f3203641b3fd8", "sha256": "4230aec69c0a743aeef85be0f869fbfb29482974f18a7ed9860d060d3b791c70" }, "downloads": -1, "filename": "plone.recipe.cluster-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1c0ee12a8308970d8c4f3203641b3fd8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22000, "upload_time": "2008-08-11T09:40:05", "url": "https://files.pythonhosted.org/packages/3b/f6/989f1283e44dda28437aba97ada14e73f2a23f8fb8cf2fc99df6760c6817/plone.recipe.cluster-0.1.0.tar.gz" } ] }