ask/celery — Issue #506: celerybeat ignores --workdir param
Author: grumbler
Created: 2011-10-14 11:52:33+00:00
State: open

I've added some prints to command handling inside celerybeat and base commands.
default loader read_configuration method is called before actual arguments parsing,

You can find more info in stack trace below.

root@ubuntu:/etc/default# sh -x /etc/init.d/celerybeat start
+ set -e
+ DEFAULT_PID_FILE=/var/run/celerybeat.pid
+ DEFAULT_LOG_FILE=/var/log/celerybeat.log
+ DEFAULT_LOG_LEVEL=INFO
+ DEFAULT_CELERYBEAT=celerybeat
+ test -f /etc/default/celeryd
+ . /etc/default/celeryd
+ CELERYD_CHDIR=/home/buruki/web/
+ CELERYBEAT_CHDIR=/home/buruki/web/
+ CELERYD=/home/buruki/venv/bin/celeryd
+ CELERYD_MULTI=/home/buruki/venv/bin/celeryd-multi
+ CELERYBEAT=/home/buruki/venv/bin/celerybeat
+ CELERY_CONFIG_MODULE=celeryconfig
+ CELERYD_LOG_LEVEL=DEBUG
+ CELERYBEAT_LOG_LEVEL=DEBUG
+ CELERYBEAT_OPTS=--schedule=/home/buruki/celerybeat-schedule
+ CELERYD_LOG_FILE=/home/buruki/celery/run/%n.log
+ CELERYD_PID_FILE=/home/buruki/celery/log/%n.pid
+ CELERYD_USER=buruki
+ CELERYD_GROUP=buruki
+ test -f /etc/default/celerybeat
+ CELERYBEAT=/home/buruki/venv/bin/celerybeat
+ CELERYBEAT_PID_FILE=/var/run/celerybeat.pid
+ CELERYBEAT_LOG_FILE=/var/log/celerybeat.log
+ CELERYBEAT_LOG_LEVEL=DEBUG
+ export CELERY_LOADER
+ CELERYBEAT_OPTS=--schedule=/home/buruki/celerybeat-schedule -f /var/log/celerybeat.log -l DEBUG
+ [ -n ]
+ [ -n ]
+ [ -n ]
+ CELERYBEAT_CHDIR=/home/buruki/web/
+ [ -n /home/buruki/web/ ]
+ DAEMON_OPTS= --workdir /home/buruki/web/
+ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/sbin:/sbin
+ check_dev_null
+ [ ! -c /dev/null ]
+ start_beat
+ echo Starting celerybeat...
Starting celerybeat...
+ [ -n ]
+ /home/buruki/venv/bin/celerybeat --schedule=/home/buruki/celerybeat-schedule -f /var/log/celerybeat.log -l DEBUG --workdir /home/buruki/web/ --detach --pidfile=/var/run/celerybeat.pid
Creating command
Executing command
Setting up application
Handling argv
Parsing options
Creating parser
Reading configuration
File "/home/buruki/venv/bin/celerybeat", line 9, in
load_entry_point('celery==2.3.3', 'console_scripts', 'celerybeat')()
File "/home/buruki/venv/lib/python2.6/site-packages/celery/bin/celerybeat.py", line 86, in main
beat.execute_from_commandline()
File "/home/buruki/venv/lib/python2.6/site-packages/celery/bin/base.py", line 74, in execute_from_commandline
return self.handle_argv(prog_name, argv[1:])
File "/home/buruki/venv/lib/python2.6/site-packages/celery/bin/base.py", line 96, in handle_argv
options, args = self.parse_options(prog_name, argv)
File "/home/buruki/venv/lib/python2.6/site-packages/celery/bin/base.py", line 114, in parse_options
parser = self.create_parser(prog_name)
File "/home/buruki/venv/lib/python2.6/site-packages/celery/bin/base.py", line 125, in create_parser
self.get_options()))
File "/home/buruki/venv/lib/python2.6/site-packages/celery/bin/celerybeat.py", line 54, in get_options
conf = self.app.conf
File "/home/buruki/venv/lib/python2.6/site-packages/kombu/utils/__init__.py", line 220, in __get__
value = obj.__dict__[self.__name__] = self.__get(obj)
File "/home/buruki/venv/lib/python2.6/site-packages/celery/app/base.py", line 392, in conf
return self._get_config()
File "/home/buruki/venv/lib/python2.6/site-packages/celery/app/base.py", line 346, in _get_config
return Settings({}, [self.prepare_config(self.loader.conf),
File "/home/buruki/venv/lib/python2.6/site-packages/celery/loaders/base.py", line 177, in conf
self._conf = self.read_configuration()
File "/home/buruki/venv/lib/python2.6/site-packages/celery/loaders/default.py", line 28, in read_configuration
print_stack()
Current dir: /etc/default
Sys.path: ['/etc/default', '/home/buruki/venv/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg', '/home/buruki/venv/lib/python2.6/site-packages', '/home/buruki/venv/bin', '/home/buruki/venv/src/django-multilingual-ng', '/home/buruki/venv/lib/python2.6', '/home/buruki/venv/lib/python2.6/plat-linux2', '/home/buruki/venv/lib/python2.6/lib-tk', '/home/buruki/venv/lib/python2.6/lib-old', '/home/buruki/venv/lib/python2.6/lib-dynload', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/home/buruki/venv/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']
/home/buruki/venv/lib/python2.6/site-packages/celery/loaders/default.py:36: NotConfigured: No 'celeryconfig' module found! Please make sure it exists and is available to Python.
"is available to Python." % (configname, )))
Parsing arguments
Returning
Running from base
Executing run
Executing celerybeat with detach
+ exit 0
root@ubuntu:/etc/default#