所以我有一個是給我這個AmbiguousTimeError Django的網站。我保存的產品在更新我的搜索索引之前被暫時暫停時會激活一項工作。看起來像在夏令時時間進行更新,pytz無法弄清楚如何處理它。AmbiguousTimeError芹菜| Django的
我怎樣才能防止這種情況發生下一次的DST小時值班?
[2012-11-06 14:22:52,115: ERROR/MainProcess] Unrecoverable error: AmbiguousTimeError(datetime.datetime(2012, 11, 4, 1, 11, 4, 335637),)
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/celery/worker/__init__.py", line 353, in start
component.start()
File "/usr/local/lib/python2.6/dist-packages/celery/worker/consumer.py", line 369, in start
self.consume_messages()
File "/usr/local/lib/python2.6/dist-packages/celery/worker/consumer.py", line 842, in consume_messages
self.connection.drain_events(timeout=10.0)
File "/usr/local/lib/python2.6/dist-packages/kombu/connection.py", line 191, in drain_events
return self.transport.drain_events(self.connection, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/kombu/transport/virtual/__init__.py", line 760, in drain_events
self._callbacks[queue](message)
File "/usr/local/lib/python2.6/dist-packages/kombu/transport/virtual/__init__.py", line 465, in _callback
return callback(message)
File "/usr/local/lib/python2.6/dist-packages/kombu/messaging.py", line 485, in _receive_callback
self.receive(decoded, message)
File "/usr/local/lib/python2.6/dist-packages/kombu/messaging.py", line 457, in receive
[callback(body, message) for callback in callbacks]
File "/usr/local/lib/python2.6/dist-packages/celery/worker/consumer.py", line 560, in receive_message
self.strategies[name](message, body, message.ack_log_error)
File "/usr/local/lib/python2.6/dist-packages/celery/worker/strategy.py", line 25, in task_message_handler
delivery_info=message.delivery_info))
File "/usr/local/lib/python2.6/dist-packages/celery/worker/job.py", line 120, in __init__
self.eta = tz_to_local(maybe_iso8601(eta), self.tzlocal, tz)
File "/usr/local/lib/python2.6/dist-packages/celery/utils/timeutils.py", line 52, in to_local
dt = make_aware(dt, orig or self.utc)
File "/usr/local/lib/python2.6/dist-packages/celery/utils/timeutils.py", line 211, in make_aware
return localize(dt, is_dst=None)
File "/usr/local/lib/python2.6/dist-packages/pytz/tzinfo.py", line 349, in localize
raise AmbiguousTimeError(dt)
AmbiguousTimeError: 2012-11-04 01:11:04.335637
編輯:我這個代碼芹菜暫時固定它:
芹菜/工人/ job.py @行120
try:
self.eta = tz_to_local(maybe_iso8601(eta), self.tzlocal, tz)
except:
self.eta = None
我不希望有變化在一個點安裝的應用程序,所以我需要修復我可以在我的代碼:
這運行時,我保存我的應用程序:
self.task_cls.apply_async(
args=[action, get_identifier(instance)],
countdown=15
)
我假設我需要,如果我在曖昧的時候我以某種方式檢測並調整倒計時。
感謝我試圖澄清。 – leech
@leech:還沒有代碼,也沒有跡象表明你在哪裏使用本地時間或爲什麼。 –
+1您剛剛突破五十萬的口碑那麼恭喜,當你說你會在今年(10萬9個月)年底將達到500K +你是對的。看到這個[評論](http://stackoverflow.com/questions/9203419/practical-example-for-immutable-class#comment11584296_9203445):) –