Skip to content

OOM fix for Spectrograms, admin console branding#266

Merged
lucaspar merged 8 commits intomasterfrom
lp/oom
Mar 13, 2026
Merged

OOM fix for Spectrograms, admin console branding#266
lucaspar merged 8 commits intomasterfrom
lp/oom

Conversation

@lucaspar
Copy link
Member

@lucaspar lucaspar commented Mar 12, 2026

  • Further limiting the max FFT size $2^{14}$$2^{11}$, as it's the main cause for server running out of memory when rendering a spectrogram.
  • Single source of truth for valid values for spectrograms (themes, FFT sizes, etc), which now comes from the server.
  • Branding for Django admin pages to prevent accidental changes to production and QA databases.
  • Unified staging environment detection for web app settings.
  • Failed spectrogram generations now should render an error message instead of an endless spinner (image).
    image

@lucaspar lucaspar self-assigned this Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 22:20
@lucaspar lucaspar added bug Something isn't working refactoring General code improvements gateway Gateway component styling Special focus on styling of front-end components javascript Pull requests that update non-trivial javascript code visualization Related to SVI or the visualization component of SDS. labels Mar 12, 2026
@semanticdiff-com
Copy link

semanticdiff-com bot commented Mar 12, 2026

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses spectrogram-related OOM issues by tightening server-side validation and making the spectrogram UI consume server-provided “source of truth” configuration, and it adds environment branding to the Django admin to reduce the risk of operating on the wrong database.

Changes:

  • Introduces centralized spectrogram parameter validation/options on the server (FFT size capped at 2048) and injects those defaults/options into the spectrogram template.
  • Improves spectrogram front-end error/status handling so failed generations stop spinning and display actionable errors.
  • Adds Django admin environment branding (CSS + template) plus environment detection utilities and tests.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gateway/sds_gateway/visualizations/views.py Adds a server-built spectrogram_form context object for templates.
gateway/sds_gateway/visualizations/tests/test_views.py Verifies spectrogram view context includes server-provided defaults/options.
gateway/sds_gateway/visualizations/api_views.py Adds Pydantic-backed spectrogram param validation and new FFT cap/options.
gateway/sds_gateway/templates/visualizations/spectrogram.html Renders FFT/colormap options and numeric ranges from server context.
gateway/sds_gateway/static/js/visualizations/spectrogram/constants.js Removes now-redundant client-side spectrogram settings/options constants.
gateway/sds_gateway/static/js/visualizations/spectrogram/SpectrogramVisualization.js Improves status/error display and failed-request handling.
gateway/sds_gateway/static/js/visualizations/spectrogram/SpectrogramControls.js Switches controls to initialize from server-rendered DOM values/ranges.
gateway/sds_gateway/templates/admin/base_site.html Adds admin environment/FQDN branding and environment-based body class.
gateway/sds_gateway/static/css/admin_environment.css Styles admin header by environment via admin-env-* classes.
gateway/sds_gateway/context_processors.py Exposes ADMIN_CONSOLE_ENV to templates.
gateway/sds_gateway/users/tests/test_context_processors.py Adds tests for admin env detection and template rendering.
gateway/config/settings/utils.py Adds shared hostname/env-based staging detection + admin env label helper.
gateway/config/settings/base.py Introduces ADMIN_CONSOLE_ENV setting with normalization/defaulting.
gateway/sds_gateway/users/tests/test_admin.py Removes an unnecessary type-ignore in admin tests.
gateway/sds_gateway/api_methods/tests/test_capture_endpoints.py Small assertion tweak (idpk).
gateway/.envs/example/django.prod-example.env Sets DJANGO_DEBUG=false in prod example env.
gateway/.envs/example/django.env Sets DJANGO_DEBUG=true in local example env.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@lucaspar lucaspar requested a review from klpoland March 12, 2026 22:33
@lucaspar lucaspar merged commit 1f4c152 into master Mar 13, 2026
2 checks passed
@lucaspar lucaspar deleted the lp/oom branch March 13, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gateway Gateway component javascript Pull requests that update non-trivial javascript code refactoring General code improvements styling Special focus on styling of front-end components visualization Related to SVI or the visualization component of SDS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants