oliver006 / elasticsearch-test-data

Generate and upload test data to Elasticsearch for performance and load testing
MIT License
257 stars 122 forks source link

RuntimeError at newer tornado versions #15

Closed pavdmyt closed 5 years ago

pavdmyt commented 5 years ago

Running es_test_data.py under Python 3.7.3 and tornado==6.0.3 (version is not specified in requirements.txt) throws the following error:

$ python es_test_data.py --es_url=http://localhost:9200 --count=100 --index_name=fluentd-test-data --num_of_shards=10 --num_of_replicas=1
[I 190709 17:04:16 es_test_data:46] Trying to create index http://localhost:9200/fluentd-test-data
Traceback (most recent call last):
  File "es_test_data.py", line 276, in <module>
    tornado.ioloop.IOLoop.instance().run_sync(generate_test_data)
  File "/Users/me/.pyenv/versions/es-test-data-py37/lib/python3.7/site-packages/tornado/ioloop.py", line 532, in run_sync
    return future_cell[0].result()
  File "/Users/me/.pyenv/versions/es-test-data-py37/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper
    yielded = next(result)
  File "es_test_data.py", line 193, in generate_test_data
    create_index(tornado.options.options.index_name)
  File "es_test_data.py", line 48, in create_index
    response = tornado.httpclient.HTTPClient().fetch(request)
  File "/Users/me/.pyenv/versions/es-test-data-py37/lib/python3.7/site-packages/tornado/httpclient.py", line 107, in __init__
    self._async_client = self._io_loop.run_sync(make_client)
  File "/Users/me/.pyenv/versions/es-test-data-py37/lib/python3.7/site-packages/tornado/ioloop.py", line 526, in run_sync
    self.start()
  File "/Users/me/.pyenv/versions/es-test-data-py37/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 148, in start
    self.asyncio_loop.run_forever()
  File "/Users/me/.pyenv/versions/3.7.3/lib/python3.7/asyncio/base_events.py", line 529, in run_forever
    'Cannot run the event loop while another loop is running')
RuntimeError: Cannot run the event loop while another loop is running

Installing tornado==4.5.3 solves the issue. I've found workaround here: https://github.com/jupyter/notebook/issues/3397

oliver006 commented 5 years ago

Thanks for letting me know, i updated the requirements.txt file.