Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

terminate-runpod.py 501 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  1. import os
  2. import runpod
  3. from discord import SyncWebhook
  4. import logging
  5. logging.basicConfig(level=os.getenv("LOG_LEVEL", "INFO"))
  6. # TODO: avoid code dup
  7. def notify_discord(msg):
  8. webhook = SyncWebhook.from_url(os.getenv("DISCORD_WEBHOOK_URL"))
  9. webhook.send(msg)
  10. def log_info(msg):
  11. logging.info(msg)
  12. notify_discord(msg)
  13. runpod.api_key = os.getenv("RUNPOD_API_KEY")
  14. pod_id = os.getenv("RUNPOD_POD_ID")
  15. log_info(f"Pod {pod_id} terminated on train error")
  16. runpod.terminate_pod(pod_id)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...