0
我正在試驗異步URL獲取界面。但是當在生產環境中使用回調時,我得到一個AssertionError。在異步URL抓取回調中你可以做些什麼限制?
這是由回調函數中的數據存儲訪問引起的嗎?回調函數有什麼限制?是否還有其他API不能異步運行?
這裏的堆棧...
('The Wait() request was interrupted by an exception from another callback:', AssertionError('1',))
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 513, in __call__
handler.post(*groups)
File "/base/data/home/apps/smsmybus/15.344643308619037909/main.py", line 153, in post
self.get()
File "/base/data/home/apps/smsmybus/15.344643308619037909/main.py", line 182, in get
bus.aggregateBusesAsynch(smsBody,self.request.get('SmsSid'),self.request.get('From'))
File "/base/data/home/apps/smsmybus/15.344643308619037909/bus.py", line 296, in aggregateBusesAsynch
rpc.wait()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 460, in wait
self.__rpc.Wait()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 112, in Wait
rpc_completed = self._WaitImpl()
File "/base/python_runtime/python_lib/versions/1/google/appengine/runtime/apiproxy.py", line 108, in _WaitImpl
rpc_completed = _apphosting_runtime___python__apiproxy.Wait(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/runtime/apiproxy.py", line 171, in __MakeCallDone
self.__Callback()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 161, in __Callback
self.callback()
File "/base/data/home/apps/smsmybus/15.344643308619037909/bus.py", line 265, in <lambda>
return lambda: handle_result(rpc,stopID,routeID,sid,directionID)
File "/base/data/home/apps/smsmybus/15.344643308619037909/bus.py", line 252, in handle_result
stop.put()
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 893, in put
return datastore.Put(self._entity, rpc=rpc)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 291, in Put
'datastore_v3', 'Put', req, datastore_pb.PutResponse(), rpc)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 194, in _MakeSyncCall
rpc.wait()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 461, in wait
assert self.__rpc.state == apiproxy_rpc.RPC.FINISHING, repr(self.state)
InterruptedError: ('The Wait() request was interrupted by an exception from another callback:', AssertionError('1',))
請求完成後調用您的回調嗎?例如,當這段代碼運行時,你的主腳本是否完成執行? – 2010-09-08 09:26:00
我其實並不確定...有沒有一種方法可以強制它等待所有回調?我寧願不要在for循環中調用等待,因爲他們可以以任何順序返回。 – Greg 2010-09-08 15:34:56
終於回到看到這個問題....你是對的,尼克。我試圖在請求完成後執行回調。異步URL抓取是一項非常棒的功能。希望我早日發現它。 – Greg 2011-01-20 22:42:06