Adding John
Adding Bob
Added John
Exception in thread Thread-2:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "ndb_test.py", line 16, in test
t.put()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/_options.py", line 93, in wrapper
return wrapped(*pass_args, _options=_options, **kwargs)
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/model.py", line 4758, in _put
return self._put_async(_options=_options).result()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 190, in result
self.check_success()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 134, in check_success
self.wait()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 126, in wait
_eventloop.run1()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 411, in run1
loop.run1()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 344, in run1
delay = self.run0()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 333, in run0
callback(rpc)
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/tasklets.py", line 323, in done_callback
_eventloop.call_soon(self._advance_tasklet, yielded.result())
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 380, in call_soon
loop = get_event_loop()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 368, in get_event_loop
context = context_module.get_context()
File "/Users/fedja/Code/Bots/HistoricTrentoBotPy3/env/lib/python3.7/site-packages/google/cloud/ndb/context.py", line 65, in get_context
raise exceptions.ContextError()
google.cloud.ndb.exceptions.ContextError: No current context. NDB calls must be made in context established by google.cloud.ndb.Client.context.
Hi,
I'm not sure if this is a bug but it's not clear to me how to properly handle
client.context()when handling multiple threads.Steps to reproduce
Code example
Stack trace