Skip to content
Merged
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
3 changes: 2 additions & 1 deletion backend/app/features/ingestion/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@

router = APIRouter(prefix="/ingestions", tags=["Ingestions"])

MAX_UPLOAD_SIZE_BYTES = 50 * 1024 * 1024
# Keep this below the NGINX Ingress body-size limit to allow multipart overhead.
MAX_UPLOAD_SIZE_BYTES = 320 * 1024 * 1024
STATEFUL_INGESTION_SOURCE_TYPES = (
IngestionSourceType.HPC_PATH,
IngestionSourceType.HPC_UPLOAD,
Expand Down
10 changes: 8 additions & 2 deletions backend/tests/features/ingestion/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,10 +1989,16 @@ def test_path_endpoint_does_not_persist_empty_case_on_ingest_error(
)

def test_save_uploaded_file_rejects_large_files(self, tmp_path: Path):
file_content = b"x" * (51 * 1024 * 1024) # 51MB
file_content = b"x" * 11
upload_file = UploadFile(file=BytesIO(file_content), filename="large_file.zip")

with pytest.raises(HTTPException) as exc_info:
with (
patch(
"app.features.ingestion.api.MAX_UPLOAD_SIZE_BYTES",
10,
),
pytest.raises(HTTPException) as exc_info,
):
_save_uploaded_file_and_hash(upload_file, tmp_path / "large_file.zip")

assert exc_info.value.status_code == 413
Expand Down
2 changes: 1 addition & 1 deletion docs/deploy/nersc-spin-runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ uploads before the API processes them.

| Annotation key | Value |
| -------------- | ----- |
| `nginx.ingress.kubernetes.io/proxy-body-size` | `52m` |
| `nginx.ingress.kubernetes.io/proxy-body-size` | `325m` |

Keep this value slightly above the backend upload limit in
`backend/app/features/ingestion/api.py` to allow multipart overhead. Update the
Expand Down
Loading