Download backend/app/scratch/debug_lock.py from Paritosh-Sovereign/Friday-Subconscious: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/Paritosh-Sovereign/Friday-Subconscious/resolve/main/backend/app/scratch/debug_lock.py
- Command line
-
hf download hf://spaces/Paritosh-Sovereign/Friday-Subconscious/backend/app/scratch/debug_lock.py
-
curl -L -o debug_lock.py https://huggingface.co/spaces/Paritosh-Sovereign/Friday-Subconscious/resolve/main/backend/app/scratch/debug_lock.py
1.11 kB
| import os | |
| from sqlalchemy import create_engine, text | |
| from sqlalchemy.orm import sessionmaker | |
| # Load configuration from .env | |
| def get_db_url(): | |
| env_path = "/Users/paritosh/Desktop/Jarvis/.env" | |
| if not os.path.exists(env_path): | |
| return None | |
| with open(env_path, "r") as f: | |
| for line in f: | |
| if line.startswith("DATABASE_URL="): | |
| return line.split("=")[1].strip().strip('"') | |
| return None | |
| def check_remote_lock(): | |
| url = get_db_url() | |
| if not url: | |
| print("Error: DATABASE_URL not found in .env") | |
| return | |
| engine = create_engine(url) | |
| Session = sessionmaker(bind=engine) | |
| session = Session() | |
| try: | |
| result = session.execute(text("SELECT key, value FROM kv_store WHERE key = 'safety_lock'")).fetchone() | |
| if result: | |
| print(f"DATABASE STATUS: {result[0]} = {result[1]}") | |
| else: | |
| print("DATABASE STATUS: safety_lock record NOT FOUND") | |
| except Exception as e: | |
| print(f"Database Error: {e}") | |
| finally: | |
| session.close() | |
| if __name__ == "__main__": | |
| check_remote_lock() | |