Upload folder using huggingface_hub
Browse files
src/orchestration/flows.py
CHANGED
|
@@ -11,19 +11,7 @@ from dotenv import load_dotenv
|
|
| 11 |
|
| 12 |
load_dotenv()
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
def notify_discord(message: str):
|
| 17 |
-
"""Sends a notification to Discord."""
|
| 18 |
-
if not WEBHOOK_URL:
|
| 19 |
-
print("Warning: WEBHOOK_URL not set. Skipping notification.")
|
| 20 |
-
return
|
| 21 |
-
|
| 22 |
-
data = {"content": message}
|
| 23 |
-
try:
|
| 24 |
-
requests.post(WEBHOOK_URL, json=data)
|
| 25 |
-
except Exception as e:
|
| 26 |
-
print(f"Failed to send notification: {e}")
|
| 27 |
|
| 28 |
@task(retries=3, retry_delay_seconds=60)
|
| 29 |
def fetch_stock_data(symbol: str):
|
|
|
|
| 11 |
|
| 12 |
load_dotenv()
|
| 13 |
|
| 14 |
+
from src.orchestration.notifications import notify_discord
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
@task(retries=3, retry_delay_seconds=60)
|
| 17 |
def fetch_stock_data(symbol: str):
|
src/orchestration/notifications.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
|
| 5 |
+
load_dotenv()
|
| 6 |
+
|
| 7 |
+
WEBHOOK_URL = os.getenv("WEBHOOK_URL")
|
| 8 |
+
|
| 9 |
+
def notify_discord(message: str):
|
| 10 |
+
"""Sends a notification to Discord."""
|
| 11 |
+
if not WEBHOOK_URL:
|
| 12 |
+
print("Warning: WEBHOOK_URL not set. Skipping notification.")
|
| 13 |
+
return
|
| 14 |
+
|
| 15 |
+
data = {"content": message}
|
| 16 |
+
try:
|
| 17 |
+
response = requests.post(WEBHOOK_URL, json=data)
|
| 18 |
+
response.raise_for_status()
|
| 19 |
+
except requests.exceptions.RequestException as e:
|
| 20 |
+
print(f"Failed to send notification: {e}")
|
| 21 |
+
if 'response' in locals() and response is not None:
|
| 22 |
+
print(f"Response status: {response.status_code}")
|
| 23 |
+
print(f"Response body: {response.text}")
|
src/orchestration/test_notification.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from src.orchestration.notifications import notify_discord
|
| 2 |
+
import os
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
|
| 5 |
+
# Force load .env if available
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
+
if __name__ == "__main__":
|
| 9 |
+
print("Testing Discord notification...")
|
| 10 |
+
webhook = os.getenv("WEBHOOK_URL")
|
| 11 |
+
if not webhook:
|
| 12 |
+
print("ERROR: WEBHOOK_URL environment variable is NOT set.")
|
| 13 |
+
else:
|
| 14 |
+
print(f"WEBHOOK_URL is set (starts with {webhook[:10]}...)")
|
| 15 |
+
notify_discord("Test notification from Stock Prediction System debugging script")
|