فهرست منبع

Renames celery.bin.celerybeat -> celery.bin.beat

Ask Solem 12 سال پیش
والد
کامیت
fcb4611b8b

+ 1 - 1
celery/__main__.py

@@ -45,7 +45,7 @@ def _compat_multi():
 def _compat_beat():
     maybe_patch_concurrency()
     _warn_deprecated('celery beat')
-    from celery.bin.celerybeat import main
+    from celery.bin.beat import main
     main()
 
 

+ 1 - 1
celery/app/builtins.py

@@ -42,7 +42,7 @@ def add_backend_cleanup_task(app):
     backend.
 
     This task is also added do the periodic task schedule so that it is
-    run every day at midnight, but :program:`celerybeat` must be running
+    run every day at midnight, but :program:`celery beat` must be running
     for this to be effective.
 
     Note that not all backends do anything for this, what needs to be

+ 5 - 5
celery/apps/beat.py

@@ -48,7 +48,7 @@ class Beat(configurated):
 
     def __init__(self, max_interval=None, app=None,
             socket_timeout=30, pidfile=None, no_color=None, **kwargs):
-        """Starts the celerybeat task scheduler."""
+        """Starts the beat task scheduler."""
         self.app = app = app_or_default(app or self.app)
         self.setup_defaults(kwargs, namespace='celerybeat')
 
@@ -65,7 +65,7 @@ class Beat(configurated):
 
     def run(self):
         print(str(self.colored.cyan(
-                    'celerybeat v{0} is starting.'.format(VERSION_BANNER))))
+                    'celery beat v{0} is starting.'.format(VERSION_BANNER))))
         self.init_loader()
         self.set_process_title()
         self.start_scheduler()
@@ -99,7 +99,7 @@ class Beat(configurated):
             self.install_sync_handler(beat)
             beat.start()
         except Exception as exc:
-            logger.critical('celerybeat raised exception %s: %r',
+            logger.critical('beat raised exception %s: %r',
                             exc.__class__, exc,
                             exc_info=True)
 
@@ -124,12 +124,12 @@ class Beat(configurated):
 
     def set_process_title(self):
         arg_start = 'manage' in sys.argv[0] and 2 or 1
-        platforms.set_process_title('celerybeat',
+        platforms.set_process_title('celery beat',
                                info=' '.join(sys.argv[arg_start:]))
 
     def install_sync_handler(self, beat):
         """Install a `SIGTERM` + `SIGINT` handler that saves
-        the celerybeat schedule."""
+        the beat schedule."""
 
         def _sync(signum, frame):
             beat.sync()

+ 7 - 7
celery/beat.py

@@ -240,7 +240,7 @@ class Scheduler(object):
 
     def _do_sync(self):
         try:
-            debug('Celerybeat: Synchronizing schedule...')
+            debug('beat: Synchronizing schedule...')
             self.sync()
         finally:
             self._last_sync = time.time()
@@ -285,7 +285,7 @@ class Scheduler(object):
         # callback called for each retry while the connection
         # can't be established.
         def _error_handler(exc, interval):
-            error('Celerybeat: Connection error: %s. '
+            error('beat: Connection error: %s. '
                   'Trying again in %s seconds...', exc, interval)
 
         return self.connection.ensure_connection(_error_handler,
@@ -408,19 +408,19 @@ class Service(object):
                                 self.scheduler_cls, self.app)
 
     def start(self, embedded_process=False):
-        info('Celerybeat: Starting...')
-        debug('Celerybeat: Ticking with max interval->%s',
+        info('beat: Starting...')
+        debug('beat: Ticking with max interval->%s',
               humanize_seconds(self.scheduler.max_interval))
 
         signals.beat_init.send(sender=self)
         if embedded_process:
             signals.beat_embedded_init.send(sender=self)
-            platforms.set_process_title('celerybeat')
+            platforms.set_process_title('celery beat')
 
         try:
             while not self._is_shutdown.is_set():
                 interval = self.scheduler.tick()
-                debug('Celerybeat: Waking up %s.',
+                debug('beat: Waking up %s.',
                       humanize_seconds(interval, prefix='in '))
                 time.sleep(interval)
         except (KeyboardInterrupt, SystemExit):
@@ -433,7 +433,7 @@ class Service(object):
         self._is_stopped.set()
 
     def stop(self, wait=False):
-        info('Celerybeat: Shutting down...')
+        info('beat: Shutting down...')
         self._is_shutdown.set()
         wait and self._is_stopped.wait()  # block until shutdown done.
 

+ 0 - 0
celery/bin/celerybeat.py → celery/bin/beat.py


+ 3 - 3
celery/bin/celery.py

@@ -311,16 +311,16 @@ class events(Delegate):
 
 @command
 class beat(Delegate):
-    """Start the celerybeat periodic task scheduler.
+    """Start the beat periodic task scheduler.
 
     Examples::
 
         celery beat -l info
-        celery beat -s /var/run/celerybeat/schedule --detach
+        celery beat -s /var/run/celery/beat-schedule --detach
         celery beat -S djcelery.schedulers.DatabaseScheduler
 
     """
-    Command = 'celery.bin.celerybeat:BeatCommand'
+    Command = 'celery.bin.beat:BeatCommand'
 
 
 @command

+ 2 - 2
celery/bin/celeryd.py

@@ -36,7 +36,7 @@ The :program:`celery worker` command (previously known as ``celeryd``)
 
 .. cmdoption:: -B, --beat
 
-    Also run the `celerybeat` periodic task scheduler. Please note that
+    Also run the `celery beat` periodic task scheduler. Please note that
     there must only be one instance of this service.
 
 .. cmdoption:: -Q, --queues
@@ -151,7 +151,7 @@ class WorkerCommand(Command):
                     self.app.conf.CELERYD_POOL)
         if self.app.IS_WINDOWS and kwargs.get('beat'):
             self.die('-B option does not work on Windows.  '
-                     'Please run celerybeat as a separate service.')
+                     'Please run celery beat as a separate service.')
         hostname = self.simple_format(hostname)
         if loglevel:
             try:

+ 1 - 1
celery/schedules.py

@@ -71,7 +71,7 @@ class schedule(object):
 
         You can override this to decide the interval at runtime,
         but keep in mind the value of :setting:`CELERYBEAT_MAX_LOOP_INTERVAL`,
-        which decides the maximum number of seconds celerybeat can sleep
+        which decides the maximum number of seconds the Beat scheduler can sleep
         between re-checking the periodic task intervals.  So if you
         dynamically change the next run at value, and the max interval is
         set to 5 minutes, it will take 5 minutes for the change to take

+ 7 - 7
celery/tests/bin/test_celerybeat.py → celery/tests/bin/test_beat.py

@@ -11,7 +11,7 @@ from mock import patch
 from celery import beat
 from celery import platforms
 from celery.app import app_or_default
-from celery.bin import celerybeat as celerybeat_bin
+from celery.bin import beat as beat_bin
 from celery.apps import beat as beatapp
 
 from celery.tests.utils import AppCase
@@ -155,8 +155,8 @@ class test_div(AppCase):
 
     def setup(self):
         self.prev, beatapp.Beat = beatapp.Beat, MockBeat
-        self.ctx, celerybeat_bin.detached = \
-                celerybeat_bin.detached, MockDaemonContext
+        self.ctx, beat_bin.detached = \
+                beat_bin.detached, MockDaemonContext
 
     def teardown(self):
         beatapp.Beat = self.prev
@@ -164,20 +164,20 @@ class test_div(AppCase):
     def test_main(self):
         sys.argv = [sys.argv[0], '-s', 'foo']
         try:
-            celerybeat_bin.main()
+            beat_bin.main()
             self.assertTrue(MockBeat.running)
         finally:
             MockBeat.running = False
 
     def test_detach(self):
-        cmd = celerybeat_bin.BeatCommand()
+        cmd = beat_bin.BeatCommand()
         cmd.app = app_or_default()
         cmd.run(detach=True)
         self.assertTrue(MockDaemonContext.opened)
         self.assertTrue(MockDaemonContext.closed)
 
     def test_parse_options(self):
-        cmd = celerybeat_bin.BeatCommand()
+        cmd = beat_bin.BeatCommand()
         cmd.app = app_or_default()
-        options, args = cmd.parse_options('celerybeat', ['-s', 'foo'])
+        options, args = cmd.parse_options('celery beat', ['-s', 'foo'])
         self.assertEqual(options.schedule, 'foo')

+ 1 - 1
celery/tests/worker/test_worker.py

@@ -893,7 +893,7 @@ class test_WorkController(AppCase):
         self.assertTrue(worker.mediator)
         self.assertTrue(worker.steps)
 
-    def test_with_embedded_celerybeat(self):
+    def test_with_embedded_beat(self):
         worker = WorkController(concurrency=1, loglevel=0, beat=True)
         self.assertTrue(worker.beat)
         self.assertIn(worker.beat, [w.obj for w in worker.steps])

+ 1 - 1
celery/worker/components.py

@@ -181,7 +181,7 @@ class Pool(bootsteps.StartStopStep):
 
 
 class Beat(bootsteps.StartStopStep):
-    """Step used to embed a celerybeat process.
+    """Step used to embed a beat process.
 
     This will only be enabled if the ``beat``
     argument is set.

+ 10 - 10
docs/configuration.rst

@@ -925,7 +925,7 @@ A built-in periodic task will delete the results after this time
     For the moment this only works with the amqp, database, cache, redis and MongoDB
     backends.
 
-    When using the database or MongoDB backends, `celerybeat` must be
+    When using the database or MongoDB backends, `celery beat` must be
     running for the results to be expired.
 
 .. setting:: CELERY_MAX_CACHED_RESULTS
@@ -1392,7 +1392,7 @@ If enabled `stdout` and `stderr` will be redirected
 to the current logger.
 
 Enabled by default.
-Used by :program:`celeryd` and :program:`celerybeat`.
+Used by :program:`celery worker` and :program:`celery beat`.
 
 .. setting:: CELERY_REDIRECT_STDOUTS_LEVEL
 
@@ -1536,15 +1536,15 @@ by the pool implementation.
 
 .. _conf-celerybeat:
 
-Periodic Task Server: celerybeat
---------------------------------
+Periodic Task Server: celery beat
+---------------------------------
 
 .. setting:: CELERYBEAT_SCHEDULE
 
 CELERYBEAT_SCHEDULE
 ~~~~~~~~~~~~~~~~~~~
 
-The periodic task schedule used by :mod:`~celery.bin.celerybeat`.
+The periodic task schedule used by :mod:`~celery.bin.beat`.
 See :ref:`beat-entries`.
 
 .. setting:: CELERYBEAT_SCHEDULER
@@ -1556,7 +1556,7 @@ The default scheduler class.  Default is
 `"celery.beat.PersistentScheduler"`.
 
 Can also be set via the :option:`-S` argument to
-:mod:`~celery.bin.celerybeat`.
+:mod:`~celery.bin.beat`.
 
 .. setting:: CELERYBEAT_SCHEDULE_FILENAME
 
@@ -1568,24 +1568,24 @@ of periodic tasks.  Can be a relative or absolute path, but be aware that the
 suffix `.db` may be appended to the file name (depending on Python version).
 
 Can also be set via the :option:`--schedule` argument to
-:mod:`~celery.bin.celerybeat`.
+:mod:`~celery.bin.beat`.
 
 .. setting:: CELERYBEAT_MAX_LOOP_INTERVAL
 
 CELERYBEAT_MAX_LOOP_INTERVAL
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-The maximum number of seconds :mod:`~celery.bin.celerybeat` can sleep
+The maximum number of seconds :mod:`~celery.bin.beat` can sleep
 between checking the schedule.
 
 
 The default for this value is scheduler specific.
-For the default celerybeat scheduler the value is 300 (5 minutes),
+For the default celery beat scheduler the value is 300 (5 minutes),
 but for e.g. the django-celery database scheduler it is 5 seconds
 because the schedule may be changed externally, and so it must take
 changes to the schedule into account.
 
-Also when running celerybeat embedded (:option:`-B`) on Jython as a thread
+Also when running celery beat embedded (:option:`-B`) on Jython as a thread
 the max interval is overridden and set to 1 so that it's possible
 to shut down in a timely manner.
 

+ 2 - 2
docs/faq.rst

@@ -477,7 +477,7 @@ Is it safe to run :program:`celeryd` as root?
 
 We're not currently aware of any security issues, but it would
 be incredibly naive to assume that they don't exist, so running
-the Celery services (:program:`celeryd`, :program:`celerybeat`,
+the Celery services (:program:`celery worker`, :program:`celery beat`,
 :program:`celeryev`, etc) as an unprivileged user is recommended.
 
 .. _faq-brokers:
@@ -892,5 +892,5 @@ Windows
 
 The `-B` / `--beat` option to celeryd doesn't work?
 ----------------------------------------------------------------
-**Answer**: That's right. Run `celerybeat` and `celeryd` as separate
+**Answer**: That's right. Run `celery beat` and `celery worker` as separate
 services instead.

+ 4 - 7
docs/internals/app-overview.rst

@@ -222,7 +222,7 @@ App Dependency Tree
 * {app.AsyncResult}
     * celery.result.BaseAsyncResult / celery.result.AsyncResult
 
-* celery.bin.celeryd.WorkerCommand
+* celery.bin.worker.WorkerCommand
     * celery.apps.worker.Worker
         * celery.worker.WorkerController
             * celery.worker.consumer.Consumer
@@ -235,7 +235,7 @@ App Dependency Tree
             * celery.worker.controllers.Mediator
             * celery.beat.EmbeddedService
 
-* celery.bin.celeryev.run_celeryev
+* celery.bin.events.EvCommand
     * celery.events.snapshot.evcam
         * celery.events.snapshot.Polaroid
         * celery.events.EventReceiver
@@ -245,12 +245,9 @@ App Dependency Tree
     * celery.events.dumper
         * celery.events.EventReceiver
 
-* celery.bin.celeryctl.celeryctl
-    * celery.bin.celeryctl.Command
+* celery.bin.amqp.AMQPAdmin
 
-* celery.bin.caqmadm.AMQPAdmin
-
-* celery.bin.celerybeat.BeatCommand
+* celery.bin.beat.BeatCommand
     * celery.apps.beat.Beat
         * celery.beat.Service
             * celery.beat.Scheduler

+ 2 - 1
docs/internals/guide.rst

@@ -259,7 +259,8 @@ Module Overview
 
 - celery.apps
 
-    Major user applications: ``celeryd``, and ``celerybeat``
+    Major user applications: worker and beat.
+    The command-line wrappers for these are in celery.bin (see below)
 
 - celery.bin
 

+ 3 - 3
docs/reference/celery.bin.celerybeat.rst → docs/reference/celery.bin.beat.rst

@@ -1,11 +1,11 @@
 ===================================================
- celery.bin.celerybeat
+ celery.bin.beat
 ===================================================
 
 .. contents::
     :local:
-.. currentmodule:: celery.bin.celerybeat
+.. currentmodule:: celery.bin.beat
 
-.. automodule:: celery.bin.celerybeat
+.. automodule:: celery.bin.beat
     :members:
     :undoc-members:

+ 1 - 1
docs/reference/index.rst

@@ -47,7 +47,7 @@
     celery.apps.beat
     celery.bin.base
     celery.bin.celeryd
-    celery.bin.celerybeat
+    celery.bin.beat
     celery.bin.events
     celery.bin.celery
     celery.bin.amqp

+ 5 - 5
docs/userguide/signals.rst

@@ -314,15 +314,15 @@ worker_shutdown
 
 Dispatched when the worker is about to shut down.
 
-Celerybeat Signals
-------------------
+Beat Signals
+------------
 
 .. signal:: beat_init
 
 beat_init
 ~~~~~~~~~
 
-Dispatched when celerybeat starts (either standalone or embedded).
+Dispatched when :program:`celery beat` starts (either standalone or embedded).
 Sender is the :class:`celery.beat.Service` instance.
 
 .. signal:: beat_embedded_init
@@ -330,8 +330,8 @@ Sender is the :class:`celery.beat.Service` instance.
 beat_embedded_init
 ~~~~~~~~~~~~~~~~~~
 
-Dispatched in addition to the :signal:`beat_init` signal when celerybeat is
-started as an embedded process.  Sender is the
+Dispatched in addition to the :signal:`beat_init` signal when :program:`celery
+beat` is started as an embedded process.  Sender is the
 :class:`celery.beat.Service` instance.
 
 Eventlet Signals

+ 1 - 1
extra/mac/org.celeryq.celerybeat.plist

@@ -11,7 +11,7 @@
     <key>Label</key>
     <string>org.celeryq.celerybeat</string>
     <key>Program</key>
-    <string>celerybeat</string>
+    <string>celery beat</string>
     <key>ProgramArguments</key>
     <array>
         <string>--loglevel=WARNING</string>

+ 7 - 5
extra/supervisord/celerybeat.conf

@@ -1,6 +1,6 @@
-; ============================
-;  celerybeat supervisor example
-; ============================
+; ================================
+;  celery beat supervisor example
+; ================================
 
 ; NOTE: If you're using Django, you shouldn't use this file.
 ; Use
@@ -8,9 +8,11 @@
 ; instead!
 
 [program:celerybeat]
-command=celerybeat --schedule /var/lib/celery/celerybeat-schedule --loglevel=INFO
+command=celery beat -A myapp --schedule /var/lib/celery/celerybeat-schedule --loglevel=INFO
 
-; Set PYTHONPATH to the directory containing celeryconfig.py
+; remove the -A myapp argument if you are not using an app instance
+
+; Set PYTHONPATH to the directory containing app/celeryconfig.py
 environment=PYTHONPATH=/path/to/project
 
 directory=/path/to/project