From 358ff7a6f88fba04fd23b59cffdb0734d233a964 Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Thu, 10 Apr 2025 22:12:38 +0200 Subject: [PATCH] Add job processing system with streaming endpoint Introduced a `processing` router to handle job streaming using server-sent events. Added `Jobs` and `JobStatus` models for managing job-related data, along with database creation logic. Updated the `sample` router to create new job entries during experiment creation. --- backend/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/main.py b/backend/main.py index 7c5b43b..fbe6c72 100644 --- a/backend/main.py +++ b/backend/main.py @@ -90,10 +90,14 @@ with open(config_file) as f: if environment in ["test", "dev"]: cert_path = config.get("ssl_cert_path", "ssl/cert.pem") key_path = config.get("ssl_key_path", "ssl/key.pem") + ssl_dir = Path(cert_path).parent + + # Ensure the directory exists before file operations + ssl_dir.mkdir(parents=True, exist_ok=True) + elif environment == "prod": cert_path = config.get("SSL_CERT_PATH") key_path = config.get("SSL_KEY_PATH") - # Validate production SSL paths if not cert_path or not key_path: raise ValueError( "SSL_CERT_PATH and SSL_KEY_PATH must be set in config_prod.json" @@ -107,9 +111,8 @@ elif environment == "prod": else: raise ValueError(f"Unknown environment: {environment}") -# Generate SSL Key and Certificate if not exist (only for development) +# Generate SSL Key and Certificate if they do not exist if environment == "dev": - Path("ssl").mkdir(parents=True, exist_ok=True) if not Path(cert_path).exists() or not Path(key_path).exists(): ssl_heidi.generate_self_signed_cert(cert_path, key_path) @@ -235,7 +238,7 @@ if __name__ == "__main__": if is_ci or environment == "test": # Test or CI Mode: Run server process temporarily for test validation ssl_dir = Path(cert_path).parent - # ssl_dir.mkdir(parents=True, exist_ok=True) + ssl_dir.mkdir(parents=True, exist_ok=True) # Generate self-signed certs if missing if not Path(cert_path).exists() or not Path(key_path).exists():