This is my code:
ret = memcache.add(key=mykey, value=qList, time=
60*60*24*30)
logging.critical("Created cache batch %s Passed %s" %
(mykey, str(ret)))
qList = memcache.get(mykey)
For some reason, qList is None ! I have logged all values and qList is
a non empty list. Check code below where I print a lot of info in the
logs.
Detailed code here:
def MY_QC_MAX(): return 3
def MY_QC_SIZE(): return 200
def createBatchMyModels():
import random
for n in range(MY_QC_MAX()):
bnum = n + 1
mykey = "qkey_batch_"+str(bnum)
qQ = MyModel.all(keys_only=True).filter('approved',
True)
if bnum > 1:
qQ = qQ.filter('__key__ >', last_key)
rows = qQ.fetch(MY_QC_SIZE())
tot = len(rows)
if tot < MY_QC_SIZE():
logging.critical("Not enough MyModels for
batch %u, got %u" % (bnum, tot))
if tot == 0:
return
last_key = rows[tot - 1]
# create the qList
qList = list()
logging.critical("Added %u rows into key %s" % (tot,
mykey))
tmpc = 0
for r in rows:
if tmpc == 0:
logging.critical("elem %u into key %s"
% (r.id(), mykey))
tmpc = tmpc + 1
qList.append(r.id())
for elem in qList:
logging.info("key %s elem is %u" % (mykey,
elem))
memcache.delete(mykey)
ret = memcache.add(key=mykey, value=qList, time=
60*60*24*30)
logging.critical("Created cache batch %s Passed %s" %
(mykey, str(ret)))
qList = memcache.get(mykey)
if qList is None:
logging.critical(".. getNextMyModel: Did not
find key %s" % mykey)
else:
logging.critical(".. LEN : %u" % len(qList))
Sample log:
.....
02-07 03:15AM 05.240 key qkey_batch_1 elem is 13108
C 02-07 03:15AM 05.250 Created cache batch qkey_batch_1 Passed True
C 02-07 03:15AM 05.253 .. getNextQuestion: Did not find key
qkey_batch_1
C 02-07 03:15AM 05.339 Added 200 rows into key qkey_batch_2
...
Can anyone pls help !
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.