title: AppEngine 'explicitly cancelled' error
body: <p>I'm using Google AppEngine and the deferred library, with the <code>Mapper</code> class, as described <a href="http://code.google.com/appengine/articles/deferred.html" rel="nofollow noreferrer">here</a> (with some improvements as in <a href="http://www.arikfr.com/blog/app-engine-mapping-entities-using-deferred-tasks.html" rel="nofollow noreferrer">here</a>). In some iterations of the mapper I get the following error:</p>
  
  <pre><code>CancelledError: The API call datastore_v3.Put() was explicitly cancelled.
  </code></pre>
  
  <p>The Mapper usually runs fine, I used to have a higher batch size, so that it would actually hit the <code>DeadlineExceededError</code>, and that was handled correctly. </p>
  
  <p>Just to be sure, I reduced the batch_size to a very low number, so that it never even hits the <code>DeadlineExceededError</code> but I still get the <code>CancelledError</code>.</p>
  
  <p>The stack trace is as follows:</p>
  
  <pre><code>File "utils.py", line 114, in _continue
    self._batch_write()
  File "utils.py", line 76, in _batch_write
    db.put(self.to_put)
  File "/google/appengine/ext/db/__init__.py", line 1238, in put
    keys = datastore.Put(entities, rpc=rpc)
  File "/google/appengine/api/datastore.py", line 255, in Put
    'datastore_v3', 'Put', req, datastore_pb.PutResponse(), rpc)
  File "/google/appengine/api/datastore.py", line 177, in _MakeSyncCall
    rpc.check_success()
  File "/google/appengine/api/apiproxy_stub_map.py", line 474, in check_success
    self.__rpc.CheckSuccess()
  File "/google/appengine/api/apiproxy_rpc.py", line 126, in CheckSuccess
    raise self.exception
  CancelledError: The API call datastore_v3.Put() was explicitly cancelled.
  </code></pre>
  
  <p>I can't really find a lot of information about this 'explicity cancelled' error, so I was wondering what caused it and how to investigate.</p>