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.
This commit is contained in:
parent
32edeac476
commit
358ff7a6f8
@ -90,10 +90,14 @@ with open(config_file) as f:
|
|||||||
if environment in ["test", "dev"]:
|
if environment in ["test", "dev"]:
|
||||||
cert_path = config.get("ssl_cert_path", "ssl/cert.pem")
|
cert_path = config.get("ssl_cert_path", "ssl/cert.pem")
|
||||||
key_path = config.get("ssl_key_path", "ssl/key.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":
|
elif environment == "prod":
|
||||||
cert_path = config.get("SSL_CERT_PATH")
|
cert_path = config.get("SSL_CERT_PATH")
|
||||||
key_path = config.get("SSL_KEY_PATH")
|
key_path = config.get("SSL_KEY_PATH")
|
||||||
# Validate production SSL paths
|
|
||||||
if not cert_path or not key_path:
|
if not cert_path or not key_path:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"SSL_CERT_PATH and SSL_KEY_PATH must be set in config_prod.json"
|
"SSL_CERT_PATH and SSL_KEY_PATH must be set in config_prod.json"
|
||||||
@ -107,9 +111,8 @@ elif environment == "prod":
|
|||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown environment: {environment}")
|
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":
|
if environment == "dev":
|
||||||
Path("ssl").mkdir(parents=True, exist_ok=True)
|
|
||||||
if not Path(cert_path).exists() or not Path(key_path).exists():
|
if not Path(cert_path).exists() or not Path(key_path).exists():
|
||||||
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
ssl_heidi.generate_self_signed_cert(cert_path, key_path)
|
||||||
|
|
||||||
@ -235,7 +238,7 @@ if __name__ == "__main__":
|
|||||||
if is_ci or environment == "test":
|
if is_ci or environment == "test":
|
||||||
# Test or CI Mode: Run server process temporarily for test validation
|
# Test or CI Mode: Run server process temporarily for test validation
|
||||||
ssl_dir = Path(cert_path).parent
|
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
|
# Generate self-signed certs if missing
|
||||||
if not Path(cert_path).exists() or not Path(key_path).exists():
|
if not Path(cert_path).exists() or not Path(key_path).exists():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user