Skip to content
Merged

Dev #41

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ STATE_CAPTURE_ON_ERROR=false
STATE_ARCHIVE_ENABLED=true
# Archive to MinIO after this inactivity period (default: 1 hour)
STATE_ARCHIVE_AFTER_SECONDS=3600
# Keep archived states in MinIO for this many days
STATE_ARCHIVE_TTL_DAYS=7
# Keep archived states in MinIO for this many days (default: 1 day / 24 hours)
STATE_ARCHIVE_TTL_DAYS=1
# How often to check for states to archive
STATE_ARCHIVE_CHECK_INTERVAL_SECONDS=300

Expand Down
2 changes: 1 addition & 1 deletion docker/d.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
# D execution environment with BuildKit optimizations
FROM ubuntu:22.04
FROM ubuntu:24.04

ARG BUILD_DATE
ARG VERSION
Expand Down
2 changes: 1 addition & 1 deletion docker/fortran.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
# Fortran execution environment with BuildKit optimizations
FROM ubuntu:22.04
FROM ubuntu:24.04

# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
Expand Down
2 changes: 1 addition & 1 deletion docker/php.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4
# PHP execution environment with BuildKit optimizations
FROM php:8.2-cli
FROM php:8.5-cli

# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand Down
2 changes: 1 addition & 1 deletion docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Inactive states are automatically archived to MinIO for long-term storage.
| -------------------------------------- | ------- | -------------------------------------- |
| `STATE_ARCHIVE_ENABLED` | `true` | Enable MinIO cold storage archival |
| `STATE_ARCHIVE_AFTER_SECONDS` | `3600` | Archive after this inactivity (1 hour) |
| `STATE_ARCHIVE_TTL_DAYS` | `7` | Keep archives for this many days |
| `STATE_ARCHIVE_TTL_DAYS` | `1` | Keep archives for this many days (24h) |
| `STATE_ARCHIVE_CHECK_INTERVAL_SECONDS` | `300` | Archival check frequency (5 min) |

### Security Configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/STATE_PERSISTENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ When a session resumes after Redis expiry:
| -------------------------------------- | ------- | -------------------------------------- |
| `STATE_ARCHIVE_ENABLED` | `true` | Enable MinIO archival |
| `STATE_ARCHIVE_AFTER_SECONDS` | `3600` | Archive after this inactivity (1 hour) |
| `STATE_ARCHIVE_TTL_DAYS` | `7` | Keep archives for this many days |
| `STATE_ARCHIVE_TTL_DAYS` | `1` | Keep archives for this many days (24h) |
| `STATE_ARCHIVE_CHECK_INTERVAL_SECONDS` | `300` | Check frequency (5 minutes) |

### Disabling State Persistence
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
requests>=2.31.0,<3
# Core API framework
fastapi==0.127.1
fastapi==0.128.0
uvicorn[standard]==0.40.0

# Data validation and serialization
Expand All @@ -21,7 +21,7 @@ minio==7.2.20

# Docker client for container management
docker==7.1.0
requests-unixsocket==0.3.0
requests-unixsocket==0.4.1

# Date/time parsing utilities
python-dateutil==2.9.0.post0
Expand All @@ -35,11 +35,11 @@ pytest-mock==3.12.0

# Development tools
black>=24.3.0
flake8==6.1.0
flake8==7.3.0
mypy==1.7.1

# Environment management
python-dotenv==1.0.0
python-dotenv==1.2.1

# Logging
structlog==25.5.0
Expand All @@ -52,4 +52,4 @@ Unidecode==1.4.0
psutil==5.9.6

# Stress testing
locust==2.43.0
locust==2.43.1
1 change: 0 additions & 1 deletion src/api/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from ..services.execution.output import OutputProcessor
from ..utils.id_generator import generate_session_id


logger = structlog.get_logger(__name__)
router = APIRouter()

Expand Down
1 change: 0 additions & 1 deletion src/api/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from ..dependencies.auth import verify_api_key
from ..config import settings


logger = structlog.get_logger(__name__)
router = APIRouter()

Expand Down
4 changes: 2 additions & 2 deletions src/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ class Settings(BaseSettings):
description="Archive state to MinIO after this many seconds of inactivity. Default: 1 hour",
)
state_archive_ttl_days: int = Field(
default=7,
default=1,
ge=1,
le=30,
description="Keep archived states in MinIO for this many days. Default: 7 days",
description="Keep archived states in MinIO for N days. Default: 1 (24 hours)",
)
state_archive_check_interval_seconds: int = Field(
default=300,
Expand Down
1 change: 0 additions & 1 deletion src/dependencies/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from ..services.auth import get_auth_service
from ..utils.request_helpers import extract_api_key


logger = structlog.get_logger(__name__)
security = HTTPBearer(auto_error=False)

Expand Down
1 change: 0 additions & 1 deletion src/dependencies/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def inject_container_pool_to_execution_service():

Called after pool is initialized to wire it into the cached execution service.
"""
global _container_pool
if _container_pool:
execution_service = get_execution_service()
execution_service.container_pool = _container_pool
Expand Down
1 change: 0 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from .utils.logging import setup_logging
from .utils.shutdown import setup_graceful_shutdown, shutdown_handler


# Setup logging
setup_logging()
logger = structlog.get_logger()
Expand Down
1 change: 0 additions & 1 deletion src/middleware/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from ..services.metrics import metrics_collector, APIMetrics
from ..config import settings


logger = structlog.get_logger(__name__)


Expand Down
1 change: 0 additions & 1 deletion src/middleware/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from ..services.auth import get_auth_service
from ..utils.request_helpers import extract_api_key, get_client_ip


logger = structlog.get_logger(__name__)


Expand Down
1 change: 0 additions & 1 deletion src/services/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from ..models import FileInfo, FileUploadRequest
from ..utils.id_generator import generate_file_id


logger = structlog.get_logger()


Expand Down
1 change: 0 additions & 1 deletion src/services/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# Local application imports
from ..config import settings


logger = structlog.get_logger(__name__)


Expand Down
1 change: 0 additions & 1 deletion src/services/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# Local application imports
from ..config import settings


logger = structlog.get_logger(__name__)


Expand Down
6 changes: 2 additions & 4 deletions src/services/sqlite_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,15 +646,13 @@ async def get_api_keys_list(self) -> List[Dict[str, Any]]:
if not self._db:
return []

cursor = await self._db.execute(
"""
cursor = await self._db.execute("""
SELECT DISTINCT api_key_hash, COUNT(*) as usage_count
FROM executions
GROUP BY api_key_hash
ORDER BY usage_count DESC
LIMIT 50
"""
)
""")

return [
{"key_hash": row["api_key_hash"], "usage_count": row["usage_count"]}
Expand Down
1 change: 0 additions & 1 deletion src/utils/shutdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from ..services.health import health_service
from ..services.metrics import metrics_collector


logger = structlog.get_logger(__name__)


Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_file_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_upload_blocked_exe_file(self, client, auth_headers):
response = client.post("/upload", files=files, headers=auth_headers)

assert response.status_code == 415
assert "File type not allowed" in response.json()["detail"]
assert "File type not allowed" in response.json()["error"]

def test_upload_blocked_dll_file(self, client, auth_headers):
"""Test that .dll files are blocked with 415 status."""
Expand All @@ -218,7 +218,7 @@ def test_upload_blocked_dll_file(self, client, auth_headers):
response = client.post("/upload", files=files, headers=auth_headers)

assert response.status_code == 415
assert "File type not allowed" in response.json()["detail"]
assert "File type not allowed" in response.json()["error"]

def test_upload_blocked_bin_file(self, client, auth_headers):
"""Test that .bin files are blocked with 415 status."""
Expand All @@ -233,7 +233,7 @@ def test_upload_blocked_bin_file(self, client, auth_headers):
response = client.post("/upload", files=files, headers=auth_headers)

assert response.status_code == 415
assert "File type not allowed" in response.json()["detail"]
assert "File type not allowed" in response.json()["error"]

def test_upload_allowed_txt_file(self, client, auth_headers):
"""Test that allowed file types still work."""
Expand Down
Loading