Commits

hideki nara committed 839d4d4

sqlite3 はフルパス指定

  • Participants
  • Parent commits a42c5b9
  • Branches development

Comments (0)

Files changed (1)

File source/broker_choice.rst

         - 
         - 業務を時間的に直列に処理したような結果を得られる。
 
+sqlite3のパスに注意
+----------------------
+
+- 本番では使わないと思いますが、テストでパスではまる
+
+::
+
+    [2012-09-17 08:16:27,976: DEBUG/MainProcess] (0.000) 
+    SELECT "djkombu_queue"."id", "djkombu_queue"."name" FROM "djkombu_queue" WHERE "djkombu_queue"."name" = celery ; args=('celery',)
+
+    [2012-09-17 08:16:27,976: ERROR/MainProcess] Unrecoverable error: DatabaseError('no such table: djkombu_queue',)
+    Traceback (most recent call last):
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/celery/worker/__init__.py", line 353, in start
+        component.start()
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 368, in start
+        self.reset_connection()
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/celery/worker/consumer.py", line 703, in reset_connection
+        on_decode_error=self.on_decode_error)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/celery/app/amqp.py", line 257, in __init__
+        queues or self.app.amqp.queues.consume_from.values(), **kw)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/messaging.py", line 284, in __init__
+        self.revive(self.channel)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/messaging.py", line 296, in revive
+        self.declare()
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/messaging.py", line 306, in declare
+        queue.declare()
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/entity.py", line 387, in declare
+        self.queue_declare(nowait, passive=False)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/entity.py", line 409, in queue_declare
+        nowait=nowait)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/transport/virtual/__init__.py", line 400, in queue_declare
+        self._new_queue(queue, **kwargs)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/kombu/transport/django/__init__.py", line 26, in _new_queue
+        Queue.objects.get_or_create(name=queue)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/manager.py", line 134, in get_or_create
+        return self.get_query_set().get_or_create(**kwargs)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/query.py", line 442, in get_or_create
+        return self.get(**lookup), False
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/query.py", line 361, in get
+        num = len(clone)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/query.py", line 85, in __len__
+        self._result_cache = list(self.iterator())
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/query.py", line 291, in iterator
+        for row in compiler.results_iter():
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter
+        for rows in self.execute_sql(MULTI):
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
+        cursor.execute(sql, params)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in execute
+        return self.cursor.execute(sql, params)
+      File "/home/hdknr/ve/tact/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 337, in execute
+        return Database.Cursor.execute(self, query, params)
+    DatabaseError: no such table: djkombu_queue
+
+
+.. code-block:: python
+
+    # settings.py
+    import os
+    PRJ_PATH=os.path.dirname(os.path.abspath(__file__))
+    
+    DATABASES = {
+        'default': {
+            'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+            'NAME': os.path.join(PRJ_PATH,'workman.sqlite3'),                      
+                                             # Or path to database file if using sqlite3.
+            'USER': '',                      # Not used with sqlite3.
+            'PASSWORD': '',                  # Not used with sqlite3.
+            'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
+            'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
+        }
+    }
+
 Redis はWorkerが落ちた時に(RabbitMQに比べて)データロスが若干あるかも?(程度)
 ====================================================================================