s/app_name/proc_name. Update faq to say that you can set the

process_name in conf.
This commit is contained in:
benoitc 2010-02-22 19:15:48 +01:00
parent 5ff4b30c28
commit 85c773098c
6 changed files with 18 additions and 18 deletions

View File

@ -70,7 +70,7 @@ $ kill -TTOUT $masterpid
<dd>By default <tt class="docutils literal">SCRIPT_NAME</tt> is an empy string. The value could be set by
setting <tt class="docutils literal">SCRIPT_NAME</tt> in the environment or as an HTTP header.</dd>
<dt>How to name processes?</dt>
<dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can name your process with <cite>-n</cite> or just let the default.</dd>
<dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can name your process with <cite>-n</cite> or just let the default. If you use a configuration file you can set the process name with the proc_name option.</dd>
</dl>
</div>

View File

@ -25,4 +25,4 @@ How do I set SCRIPT_NAME?
setting ``SCRIPT_NAME`` in the environment or as an HTTP header.
How to name processes?
You need to install the Python package `setproctitle <http://pypi.python.org/pypi/setproctitle>`_. Then you can name your process with `-n` or just let the default.
You need to install the Python package `setproctitle <http://pypi.python.org/pypi/setproctitle>`_. Then you can name your process with `-n` or just let the default. If you use a configuration file you can set the process name with the proc_name option.

View File

@ -56,7 +56,7 @@ class Arbiter(object):
self.conf = kwargs.get("config", {})
self._pidfile = None
self.master_name = "Master"
self.app_name = self.conf['app_name']
self.proc_name = self.conf['proc_name']
# get current path, try to use PWD env first
try:
@ -162,7 +162,7 @@ class Arbiter(object):
def run(self):
""" main master loop. Launch to start the master"""
self.start()
util._setproctitle("master [%s]" % self.app_name)
util._setproctitle("master [%s]" % self.proc_name)
self.manage_workers()
while True:
try:
@ -369,7 +369,7 @@ class Arbiter(object):
# Process Child
worker_pid = os.getpid()
try:
util._setproctitle("worker [%s]" % self.app_name)
util._setproctitle("worker [%s]" % self.proc_name)
self.log.debug("Worker %s booting" % worker_pid)
self.conf.after_fork(self, worker)
worker.run()

View File

@ -13,7 +13,7 @@ from gunicorn import util
class Config(object):
DEFAULTS = dict(
app_name = os.getcwd(),
proc_name = os.getcwd(),
bind='127.0.0.1:8000',
daemon=False,
debug=False,

View File

@ -42,7 +42,7 @@ def options():
help="Change worker user"),
op.make_option('-g', '--group', dest="group",
help="Change worker group"),
op.make_option('-n', '--name', dest='app_name',
op.make_option('-n', '--name', dest='proc_name',
help="Process name"),
op.make_option('--log-level', dest='loglevel',
help='Log level below which to silence messages. [info]'),
@ -142,8 +142,8 @@ def paste_server(app, global_conf=None, host="127.0.0.1", port=None,
if key == "debug":
value = (value == "true")
options[key] = value
if not 'app_name' in options:
options['app_name'] = options['__file__']
if not 'proc_name' in options:
options['proc_name'] = options['__file__']
conf = Config(options)
arbiter = Arbiter(conf.address, conf.workers, app, debug=conf["debug"],
@ -164,8 +164,8 @@ def run():
if len(args) != 1:
parser.error("No application module specified.")
if not opts.app_name:
opts.app_name = args[0]
if not opts.proc_name:
opts.proc_name = args[0]
try:
return util.import_app(args[0])
@ -210,8 +210,8 @@ def run_django():
settings_modname = '%s.%s' % (project_name, settings_name)
os.environ['DJANGO_SETTINGS_MODULE'] = settings_modname
if not opts.app_name:
opts.app_name = settings_modname
if not opts.proc_name:
opts.proc_name = settings_modname
# django wsgi app
return django.core.handlers.wsgi.WSGIHandler()
@ -269,8 +269,8 @@ def run_paster():
if not opts.debug:
opts.debug = (ctx.global_conf.get('debug') == "true")
if not opts.app_name:
opts.app_name = ctx.global_conf.get('__file__')
if not opts.proc_name:
opts.proc_name = ctx.global_conf.get('__file__')
app = loadapp(config_url, relative_to=relative_to)
return app

View File

@ -36,7 +36,7 @@ class Command(BaseCommand):
help="Change worker user"),
make_option('-g', '--group', dest="group",
help="Change worker group"),
make_option('-n', '--name', dest='app_name',
make_option('-n', '--name', dest='proc_name',
help="Process name"),
)
help = "Starts a fully-functional Web server using gunicorn."
@ -51,8 +51,8 @@ class Command(BaseCommand):
options['bind'] = addrport or '127.0.0.1'
if not options.get('app_name'):
options['app_name'] =settings.SETTINGS_MODULE
if not options.get('proc_name'):
options['proc_name'] =settings.SETTINGS_MODULE
conf = Config(options)
admin_media_path = options.get('admin_media_path', '')