Thank you. And for completeness sake, here is the full function I'm using, just in case something else is wrong. Rather than calling the capabilities APIs on every hit, I cache the value in a global variable and check every 30 seconds.
*from google.appengine.api import capabilities* * * *# Store in a global variable so it's cached between requests.* *capabilities_check_time = None;* *datastore_writes_enabled = True;* * * *def in_read_only_mode():* * """We return True if we're in read-only mode or going to read-only one in * * 30 seconds or less. But we check the APIs every once in a while to avoid* * the extra load that causes."""* * * * global capabilities_check_time, datastore_writes_enabled* * * * buffer_in_seconds = 30 # consider us in read-only mode this much time before we actually get there* * check_period_in_seconds = 30 # time between checking the capabilities APIs* * now = datetime.datetime.now()* * * * if capabilities_check_time and capabilities_check_time > now:* * # we don't need to check the APIs we have enough info cached* * return not(datastore_writes_enabled)* * else:* * # we need to check the capabilities * * # todo: check we check memcache as well?* * datastore_writes = capabilities.CapabilitySet('datastore_v3', capabilities=['write'])* * datastore_writes_enabled = \* * datastore_writes.will_remain_enabled_for(buffer_in_seconds + check_period_in_seconds)* * capabilities_check_time = now + datetime.timedelta(seconds=check_period_in_seconds)* * return not(datastore_writes_enabled)* * * * * On Sat, Jun 12, 2010 at 2:28 PM, App Engine Team < appengine.nore...@gmail.com> wrote: > Hmm, okay we're looking into what's going on. > > On Jun 12, 2:23 pm, Waleed Abdulla <wal...@ninua.com> wrote: > > Thanks for the info. > > > > I updated my app to detect the read-only mode per Jason's > presentation[1]. > > However, now that it's in read-only mode, my app is not detecting it. So > the > > preparations I coded are not working and things are failing badly rather > > than gracefully :( > > > > This is the code I'm using: > > > > datastore_writes = capabilities.CapabilitySet('datastore_v3', > > capabilities=['write']) > > datastore_writes_enabled = \ > > datastore_writes.will_remain_enabled_for(60) > > > > I'm expecting to have datastore_writes_enabled be False when in read-only > > mode, but it's not !! > > > > Waleed > > [1] > http://www.slideshare.net/jasonacooper/strategies-for-maintaining-app... > > > > On Sat, Jun 12, 2010 at 2:12 PM, App Engine Team < > > > > appengine.nore...@gmail.com> wrote: > > > Hey Waleed > > > > > The first half of the maintenance period was actually done without > > > going read-only. We have just enabled read-only now. > > > > > On Jun 12, 1:49 pm, Waleed Abdulla <wal...@ninua.com> wrote: > > > > It was supposed to start at 1pm. I wonder if it's already in progress > or > > > not > > > > started yet! > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Google App Engine" group. > > > To post to this group, send email to google-appengine@googlegroups.com > . > > > To unsubscribe from this group, send email to > > > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com> > <google-appengine%2bunsubscr...@googlegroups.com<google-appengine%252bunsubscr...@googlegroups.com> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to google-appeng...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.