Browse Source

Removed django-specific stuff from docs

Ask Solem 15 years ago
parent
commit
6c9d7637d9

+ 0 - 56
docs/cookbook/unit-testing.rst

@@ -1,56 +0,0 @@
-================
- Unit Testing
-================
-
-Testing with Django
--------------------
-
-The problem that you'll first run in to when trying to write a test that runs a
-task is that Django's test runner doesn't use the same database that your celery
-daemon is using. If you're using the database backend, this means that your
-tombstones won't show up in your test database and you won't be able to check
-on your tasks to get the return value or check the status.
-
-There are two ways to get around this. You can either take advantage of
-``CELERY_ALWAYS_EAGER = True`` to skip the daemon, or you can avoid testing
-anything that needs to check the status or result of a task.
-
-Using a custom test runner to test with celery
-----------------------------------------------
-
-If you're going the ``CELERY_ALWAYS_EAGER`` route, which is probably better than
-just never testing some parts of your app, a custom Django test runner does the
-trick. Celery provides a simple test runner, but it's easy enough to roll your
-own if you have other things that need to be done.
-http://docs.djangoproject.com/en/dev/topics/testing/#defining-a-test-runner
-
-For this example, we'll use the ``celery.contrib.test_runner`` to test the
-``add`` task from the :doc:`User Guide: Tasks<../userguide/tasks>` examples.
-
-To enable the test runner, set the following settings:
-
-.. code-block:: python
-
-    TEST_RUNNER = 'celery.contrib.test_runner.run_tests'
-
-
-Then we can write our actually test in a ``tests.py`` somewhere:
-
-.. code-block:: python
-
-    from django.test import TestCase
-    from myapp.tasks import add
-
-    class AddTestCase(TestCase):
-
-        def testNoError(self):
-            """Test that the ``add`` task runs with no errors,
-            and returns the correct result."""
-            result = add.delay(8, 8)
-
-            self.assertEquals(result.get(), 16)
-            self.assertTrue(result.successful())
-
-
-This test assumes that you put your example ``add`` task in ``maypp.tasks``
-so of course adjust the import for wherever you actually put the class.

+ 0 - 119
docs/getting-started/first-steps-with-django.rst

@@ -1,119 +0,0 @@
-=========================
- First steps with Django
-=========================
-
-Configuring your Django project to use Celery
-=============================================
-
-You only need three simple steps to use celery with your Django project.
-
-    1. Add ``celery`` to ``INSTALLED_APPS``.
-
-    2. Create the celery database tables::
-
-            $ python manage.py syncdb
-
-    3. Configure celery to use the AMQP user and virtual host we created
-        before, by adding the following to your ``settings.py``::
-
-            BROKER_HOST = "localhost"
-            BROKER_PORT = 5672
-            BROKER_USER = "myuser"
-            BROKER_PASSWORD = "mypassword"
-            BROKER_VHOST = "myvhost"
-
-
-That's it.
-
-There are more options available, like how many processes you want to
-work in parallel (the ``CELERY_CONCURRENCY`` setting). You can also
-configure the backend used for storing task statuses. For now though,
-this should do. For all of the options available, please see the 
-:doc:`configuration directive reference<../configuration>`.
-
-**Note:** If you're using SQLite as the Django database back-end,
-``celeryd`` will only be able to process one task at a time, this is
-because SQLite doesn't allow concurrent writes.
-
-
-
-Running the celery worker server
-================================
-
-To test this we'll be running the worker server in the foreground, so we can
-see what's going on without consulting the logfile::
-
-    $ python manage.py celeryd
-
-However, in production you probably want to run the worker in the
-background as a daemon. To do this you need to use to tools provided by your
-platform. See :doc:`daemon mode reference<../cookbook/daemonizing>`.
-
-For a complete listing of the command line options available, use the help command::
-
-    $ python manage.py help celeryd
-
-
-Defining and executing tasks
-============================
-
-**Please note:** All the tasks have to be stored in a real module, they can't
-be defined in the python shell or ipython/bpython. This is because the celery
-worker server needs access to the task function to be able to run it.
-Put them in the ``tasks`` module of your Django application. The
-worker server  will automatically load any ``tasks.py`` file for all
-of the applications listed in ``settings.INSTALLED_APPS``.
-Executing tasks using ``delay`` and ``apply_async`` can be done from the
-python shell, but keep in mind that since arguments are pickled, you can't
-use custom classes defined in the shell session.
-
-This is a task that adds two numbers:
-
-.. code-block:: python
-
-    from celery.decorators import task
-
-    @task()
-    def add(x, y):
-        return x + y
-
-To execute this task, we can use the ``delay`` method of the task class.
-This is a handy shortcut to the ``apply_async`` method which gives
-greater control of the task execution.
-See :doc:`Executing Tasks<../userguide/executing>` for more information.
-
-    >>> from myapp.tasks import MyTask
-    >>> MyTask.delay(some_arg="foo")
-
-At this point, the task has been sent to the message broker. The message
-broker will hold on to the task until a celery worker server has successfully
-picked it up.
-
-*Note:* If everything is just hanging when you execute ``delay``, please check
-that RabbitMQ is running, and that the user/password has access to the virtual
-host you configured earlier.
-
-Right now we have to check the celery worker log files to know what happened
-with the task. This is because we didn't keep the ``AsyncResult`` object
-returned by ``delay``.
-
-The ``AsyncResult`` lets us find the state of the task, wait for the task to
-finish and get its return value (or exception if the task failed).
-
-So, let's execute the task again, but this time we'll keep track of the task:
-
-    >>> result = add.delay(4, 4)
-    >>> result.ready() # returns True if the task has finished processing.
-    False
-    >>> result.result # task is not ready, so no return value yet.
-    None
-    >>> result.get()   # Waits until the task is done and returns the retval.
-    8
-    >>> result.result # direct access to result, doesn't re-raise errors.
-    8
-    >>> result.successful() # returns True if the task didn't end in failure.
-    True
-
-If the task raises an exception, the return value of ``result.successful()``
-will be ``False``, and ``result.result`` will contain the exception instance
-raised by the task.

+ 0 - 8
docs/internals/reference/celery.backends.cache.rst

@@ -1,8 +0,0 @@
-=======================================
-Backend: Cache - celery.backends.cache
-=======================================
-
-.. currentmodule:: celery.backends.cache
-
-.. automodule:: celery.backends.cache
-    :members:

+ 0 - 8
docs/internals/reference/celery.backends.database.rst

@@ -1,8 +0,0 @@
-=============================================
-Backend: Database - celery.backends.database
-=============================================
-
-.. currentmodule:: celery.backends.database
-
-.. automodule:: celery.backends.database
-    :members:

+ 0 - 8
docs/internals/reference/celery.managers.rst

@@ -1,8 +0,0 @@
-========================================
-Django Model Managers - celery.managers
-========================================
-
-.. currentmodule:: celery.managers
-
-.. automodule:: celery.managers
-    :members:

+ 0 - 76
docs/internals/reference/celery.models.rst

@@ -1,76 +0,0 @@
-===============================
-Django Models - celery.models
-===============================
-
-.. data:: TASK_STATUS_PENDING
-
-    The string status of a pending task.
-
-.. data:: TASK_STATUS_RETRY
-   
-    The string status of a task which is to be retried.
-
-.. data:: TASK_STATUS_FAILURE
-   
-    The string status of a failed task.
-
-.. data:: TASK_STATUS_DONE
-   
-    The string status of a task that was successfully executed.
-
-.. data:: TASK_STATUSES
-   
-    List of possible task statuses.
-
-.. data:: TASK_STATUSES_CHOICES
-   
-    Django choice tuple of possible task statuses, for usage in model/form
-    fields ``choices`` argument.
-
-.. class:: TaskMeta
-   
-    Model for storing the result and status of a task.
-    
-    *Note* Only used if you're running the ``database`` backend.
-
-    .. attribute:: task_id
-
-        The unique task id.
-
-    .. attribute:: status
-
-        The current status for this task.
-
-    .. attribute:: result
-        
-        The result after successful/failed execution. If the task failed,
-        this contains the execption it raised.
-
-    .. attribute:: date_done
-
-        The date this task changed status.
-
-.. class:: PeriodicTaskMeta
-   
-    Metadata model for periodic tasks.
-
-    .. attribute:: name
-       
-        The name of this task, as registered in the task registry.
-
-    .. attribute:: last_run_at
-
-        The date this periodic task was last run. Used to find out
-        when it should be run next.
-
-    .. attribute:: total_run_count
-       
-        The number of times this periodic task has been run.
-
-    .. attribute:: task
-       
-        The class/function for this task.
-
-    .. method:: delay()
-        Delay the execution of a periodic task, and increment its total
-        run count.

+ 0 - 8
docs/reference/celery.bin.celeryinit.rst

@@ -1,8 +0,0 @@
-===========================================
- Celery Initialize - celery.bin.celeryinit
-===========================================
-
-.. currentmodule:: celery.bin.celeryinit
-
-.. automodule:: celery.bin.celeryinit
-    :members:

+ 0 - 8
docs/reference/celery.contrib.test_runner.rst

@@ -1,8 +0,0 @@
-===================================================
- Contrib: Test runner - celery.contrib.test_runner
-===================================================
-
-.. currentmodule:: celery.contrib.test_runner
-
-.. automodule:: celery.contrib.test_runner
-    :members:

+ 0 - 8
docs/reference/celery.loaders.djangoapp.rst

@@ -1,8 +0,0 @@
-==========================================
- Django Loader - celery.loaders.djangoapp
-==========================================
-
-.. currentmodule:: celery.loaders.djangoapp
-
-.. automodule:: celery.loaders.djangoapp
-    :members:

+ 0 - 8
docs/reference/celery.views.rst

@@ -1,8 +0,0 @@
-========================================
-Django Views - celery.views
-========================================
-
-.. currentmodule:: celery.views
-
-.. automodule:: celery.views
-    :members: