Open jhutar opened 4 years ago
Hello. I have no idea on what am I doing, but it seems to work like this:
--- /usr/local/lib/python3.6/site-packages/receptor_stresstest/worker.py 2020-03-30 21:11:20.000000000 +0000
+++ /usr/local/lib/python3.6/site-packages/receptor_stresstest/worker.py.CHANGED 2020-03-30 21:11:04.092821896 +0000
@@ -23,10 +23,11 @@
self.size = size
async def run(self):
+ loop = asyncio.get_event_loop()
seconds_left = self.length
while seconds_left:
for _ in range(self.rate):
- asyncio.create_task(self.emit())
+ loop.create_task(self.emit())
await asyncio.sleep(1)
seconds_left -= 1
await asyncio.sleep(1)
@@ -45,7 +46,10 @@
def blunderbuss(message, config, queue):
args = json.loads(message.raw_payload)
response_generator = Blunderbuss(queue, **args)
- asyncio.run(response_generator.run())
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ loop.run_until_complete(response_generator.run())
blunderbuss.receptor_export = True
@jhutar can you post a PR to make that change? This is happening because stresstest is written towards python 3.8 but the rest of receptor requires python 3.6
Hello @matburt. Well, I have absolutely no idea how asyncio
works. I just put 2 StackOverflow answers together to make this work, so I would prefer if somebody competent would do the change. But if the change seems good and there is no more work needed on it, I will happily create the PR.
Doesn't matter! It looks good to me so open a PR!
I have installed
stresstest
into RHEL7 receptor deployment:where I have:
and when I attempted to trigger the test from the controller, it says: