From ed7b512f40c3e0b94b109130c620eec260b2eff7 Mon Sep 17 00:00:00 2001 From: James Hush Date: Fri, 20 Dec 2024 15:40:48 +0800 Subject: [PATCH] Change logic to launch 4 bots per min --- .../batch_dialout_bot.py | 6 ++- .../batch_dialout_demo.py | 7 ++-- examples/batch-dialout-chatbot/output.csv | 42 ++++++++++++++++++- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/examples/batch-dialout-chatbot/batch_dialout_bot.py b/examples/batch-dialout-chatbot/batch_dialout_bot.py index 8f4a71936..b78c86e51 100644 --- a/examples/batch-dialout-chatbot/batch_dialout_bot.py +++ b/examples/batch-dialout-chatbot/batch_dialout_bot.py @@ -88,14 +88,16 @@ class DialoutBot: phone_numbers = [ "+12097135124", # James "+12097135125", # James - "+19499870006", # Varun + self.phone_number, + # "+19499870006", # Varun ] return phone_numbers[callId % len(phone_numbers)] else: phone_numbers = [ "+14155204406", # James "+18187229086", # James (Avoca) - "+16673870006", # Varun + self.phone_number, + # "+16673870006", # Varun ] return phone_numbers[callId % len(phone_numbers)] diff --git a/examples/batch-dialout-chatbot/batch_dialout_demo.py b/examples/batch-dialout-chatbot/batch_dialout_demo.py index fd0fe2a04..096e2a3a4 100644 --- a/examples/batch-dialout-chatbot/batch_dialout_demo.py +++ b/examples/batch-dialout-chatbot/batch_dialout_demo.py @@ -25,7 +25,7 @@ async def run_bot(id: int, run_number: int, bot_run_time: int, phone_number: str ) # Create daily.co room with dialin and dialout enabled - exp = time.time() + bot_run_time + exp = time.time() + bot_run_time + 600 room_params = DailyRoomParams( properties=DailyRoomProperties( exp=exp, @@ -59,6 +59,7 @@ async def run_bot(id: int, run_number: int, bot_run_time: int, phone_number: str [id, "Rate Limit Error", datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-3]] ) + await asyncio.sleep(15) bot_proc = f"python3 -m batch_dialout_bot -u {room.url} -t {token} -i {id} -r {run_number} -p {phone_number}" try: @@ -96,8 +97,8 @@ async def main(): ] print(f"-- Number of bots: {len(bots)}") await asyncio.gather(*bots) - print(f"-- Waiting {bot_run_time + 30} seconds...") - await asyncio.sleep(bot_run_time + 30) + print(f"-- Waiting {bot_run_time} seconds...") + await asyncio.sleep(bot_run_time) print(f"-- Finished waiting {bot_run_time} seconds...") diff --git a/examples/batch-dialout-chatbot/output.csv b/examples/batch-dialout-chatbot/output.csv index 103aebbbe..d3f18ffe9 100644 --- a/examples/batch-dialout-chatbot/output.csv +++ b/examples/batch-dialout-chatbot/output.csv @@ -1,3 +1,41 @@ bot_id,enable_dialout,timestamp -0,True,2024-12-10 15:24:10.529 -0,True,2024-12-10 15:24:51.754 +0,True,2024-12-20 15:16:38.801 +2,True,2024-12-20 15:16:38.804 +3,True,2024-12-20 15:16:38.835 +1,True,2024-12-20 15:16:38.940 +0,True,2024-12-20 15:17:55.016 +2,True,2024-12-20 15:17:55.038 +1,True,2024-12-20 15:17:55.102 +3,True,2024-12-20 15:17:55.174 +0,True,2024-12-20 15:19:11.256 +2,True,2024-12-20 15:19:11.294 +3,True,2024-12-20 15:19:11.320 +1,True,2024-12-20 15:19:11.336 +0,True,2024-12-20 15:20:27.439 +1,True,2024-12-20 15:20:27.461 +3,True,2024-12-20 15:20:27.465 +2,True,2024-12-20 15:20:27.472 +3,True,2024-12-20 15:21:43.567 +0,True,2024-12-20 15:21:43.592 +1,True,2024-12-20 15:21:43.606 +2,True,2024-12-20 15:21:43.750 +3,True,2024-12-20 15:22:59.818 +2,True,2024-12-20 15:22:59.825 +0,True,2024-12-20 15:22:59.844 +1,True,2024-12-20 15:22:59.853 +2,True,2024-12-20 15:24:15.971 +3,True,2024-12-20 15:24:15.976 +0,True,2024-12-20 15:24:16.035 +1,True,2024-12-20 15:24:16.099 +2,True,2024-12-20 15:25:32.202 +0,True,2024-12-20 15:25:32.223 +3,True,2024-12-20 15:25:32.276 +1,True,2024-12-20 15:25:32.334 +3,True,2024-12-20 15:26:48.410 +0,True,2024-12-20 15:26:48.449 +1,True,2024-12-20 15:26:48.504 +2,True,2024-12-20 15:26:48.540 +3,True,2024-12-20 15:28:04.604 +0,True,2024-12-20 15:28:04.604 +2,True,2024-12-20 15:28:04.614 +1,True,2024-12-20 15:28:04.648