Commits

Anonymous committed dd7c07f

Got all of the commands in except for celerymulti (do we need celerymulti?)

Comments (0)

Files changed (4)

celery_pylons.egg-info/SOURCES.txt

 celery_pylons.egg-info/zip-safe
 celerypylons/__init__.py
 celerypylons/commands.py
-celerypylons/loader.py
+celerypylons/config.py
+celerypylons/dummy.py

celery_pylons.egg-info/entry_points.txt

       # -*- Entry points: -*-
       [paste.global_paster_command]
       celeryd=celerypylons.commands:CeleryDaemonCommand
+      celerybeat=celerypylons.commands:CeleryBeatCommand
+      camqadm=celerypylons.commands:CAMQPAdminCommand
+      celeryev=celerypylons.commands:CeleryEventCommand
       

celerypylons/commands.py

 from paste.script.command import Command, BadCommand
 import paste.deploy
 from pylons import config
+from celery.exceptions import ImproperlyConfigured
 
-__all__ = ['CeleryDaemonCommand'] #, 'CeleryBeatCommand', 'CAMQPAdminCommand', 'CeleryEventCommand']
+
+__all__ = ['CeleryDaemonCommand', 'CeleryBeatCommand', 'CAMQPAdminCommand', 'CeleryEventCommand']
 
 
 ## @@ We have to do some rather odd bootstrapping in order to get
 
 
 ## @@ We can now import celeryd since the configuration has been set.
-from celery.bin import celeryd
+try:
+    ## @@ If paster is run without arguments this file is imported,
+    ## yet there is no config file passed in, which causes these
+    ## imports to fail due to a configuration error.
+    from celery.bin import celeryd
+    from celery.bin import celerybeat
+    from celery.bin import camqadm
+    from celery.bin import celeryev
+except ImproperlyConfigured:
+    import dummy as celeryd
+    import dummy as celerybeat
+    import dummy as camqadm
+    import dummy as celeryev
 
 
 class CeleryDaemonCommand(Command):
     """Start the celery worker
 
-    This command starts the celery worker that uses a paste.deploy
-    configuration file for the daemon and the worker configuration.
+    Starts the celery worker that uses a paste.deploy configuration
+    file.
     """
     min_args = 1
     min_args_error = "Please provide a paster config file as an argument."
     def command(self):
         options = celeryd.parse_options(sys.argv[3:])
         return celeryd.run_worker(**vars(options))
+
+
+class CeleryBeatCommand(Command):
+    """Start the celery beat server
+
+    Starts the celery beat server using a paste.deploy configuration
+    file.
+    """
+    min_args = 1
+    min_args_error = "Please provide a paster config file as an argument."
+    usage = 'CONFIG_FILE [celerybeat options...]'
+    takes_config_file = 1
+    summary = __doc__.splitlines()[0]
+    description = "".join(__doc__.splitlines()[2:])
+    requires_config_file = True
+
+    parser = Command.standard_parser(quiet=True)
+    for x in celerybeat.OPTION_LIST:
+        parser.add_option(x)
+        
+    def command(self):
+        options = celerybeat.parse_options(sys.argv[3:])
+        return celerybeat.run_celerybeat(**vars(options))
+
+
+class CAMQPAdminCommand(Command):
+    """CAMQP Admin
+
+    CAMQP celery admin tool.
+    """
+    min_args = 1
+    min_args_error = "Please provide a paster config file as an argument."
+    usage = 'CONFIG_FILE [camqadm options...]'
+    takes_config_file = 1
+    summary = __doc__.splitlines()[0]
+    description = "".join(__doc__.splitlines()[2:])
+    requires_config_file = True
+
+    parser = Command.standard_parser(quiet=True)
+    for x in camqadm.OPTION_LIST:
+        parser.add_option(x)
+        
+    def command(self):
+        options, values = camqadm.parse_options(sys.argv[3:])
+        return camqadm.camqadm(*values, **vars(options))
+
+    
+class CeleryEventCommand(Command):
+    """Celery event commandd.
+
+    Capture celery events.
+    """
+    min_args = 1
+    min_args_error = "Please provide a paster config file as an argument."
+    usage = 'CONFIG_FILE [camqadm options...]'
+    takes_config_file = 1
+    summary = __doc__.splitlines()[0]
+    description = "".join(__doc__.splitlines()[2:])
+    requires_config_file = True
+
+    parser = Command.standard_parser(quiet=True)
+    for x in celeryev.OPTION_LIST:
+        parser.add_option(x)
+        
+    def command(self):
+        options = celeryev.parse_options(sys.argv[3:])
+        return celeryev.run_celeryev(**vars(options))
       # -*- Entry points: -*-
       [paste.global_paster_command]
       celeryd=celerypylons.commands:CeleryDaemonCommand
+      celerybeat=celerypylons.commands:CeleryBeatCommand
+      camqadm=celerypylons.commands:CAMQPAdminCommand
+      celeryev=celerypylons.commands:CeleryEventCommand
       """,
       )