diff --git a/bot/bot.py b/bot/bot.py index fbf4135..46c602e 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -101,6 +101,8 @@ async def update_active_threads(): @client.event async def on_ready(): print(f"Logged in as {client.user}") + channel = client.get_channel(DISCORD_DST_CHANNEL_ID) + await channel.send("開始模擬即時資料") # channel = client.get_channel(DISCORD_DST_CHANNEL_ID) # client.loop.create_task(update_active_threads()) # if channel: @@ -159,9 +161,10 @@ def run_bot(): # @client.event # async def on_ready(): -# print(f'{client.user} has connected to Discord!') -# print("TSMC System Bot is Online!") -# client.loop.create_task(warning_task()) +# # print(f'{client.user} has connected to Discord!') +# # print("TSMC System Bot is Online!") +# channel = client.get_channel(DISCORD_DST_CHANNEL_ID) +# await channel.send("開始模擬即時資料") # client.run(DISCORD_BOT_TOKEN) diff --git a/monitor/README.md b/monitor/README.md index a99b81b..297ee57 100644 --- a/monitor/README.md +++ b/monitor/README.md @@ -1,4 +1,4 @@ -# Cloud Run Monitor System +# Cloud Run Monitor Controller ## Setup `gcloud` environment diff --git a/simulate_runner.py b/simulate_runner.py index d6d515c..40cad94 100644 --- a/simulate_runner.py +++ b/simulate_runner.py @@ -34,12 +34,17 @@ def is_end(self): async def main(data_directory: str): + # channel_id = os.getenv("DISCORD_DST_CHANNEL_ID") simulate_data: pd.DataFrame = preprocess_metric_data(data_directory) data_simulator = RealTimeDataSimulator(simulate_data) bot_thread = threading.Thread(target=run_bot) bot_thread.start() + while not client.is_ready(): + await asyncio.sleep(1) + # channel = await client.get_channel(channel_id) + # await channel.send(f"開始模擬 {data_directory} 資料") while not data_simulator.is_end(): - chunk = data_simulator.get_next_chunk(50) + chunk = data_simulator.get_next_chunk(10) result = analyze_by_llm(chunk) print(result) result["timestamp"] = datetime.datetime.now()