Repository navigation
Public Scenarios app on the installer stack - #57
Merged
Merged
Conversation
The UI and setup scripts now take the service account from OASIS_SERVICE_USERNAME_OR_ID / OASIS_SERVICE_PASSWORD_OR_SECRET (exported by install.sh from .env), falling back to .streamlit/secrets.toml. A deployment's credentials only need setting in .env, and secrets.toml can't drift from the platform's admin password. quiet_login also handles failed logins instead of crashing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The output views are Streamlit fragments, which display their own exceptions, so the earlier try/except never caught a missing output and users saw a stack trace. Results now check the file exists first. OutputInterface also finds .parquet outputs (ORD parquet_format), which were previously reported as missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A separate, credential-free app (scenarios_app.py, pages in scenarios_ui/) for showing newcomers how to run models: visitors run pre-loaded scenarios against pre-loaded exposure and explore the results, but cannot upload or delete anything. - st.navigation registers only the Scenarios pages, so the standard UI's pages are unreachable from this app (it ignores pages/) - Run a scenario: choose a scenario (cards), check its exposure (figures and map), choose samples and a loss breakdown, run with live progress, and see results on the page; 'Your runs' lists the visitor's runs - Showcase: pre-computed runs (tagged [showcase]) to explore without waiting - Compare: two runs side by side, from the showcase and the visitor's own runs (moved from pages/comparison.py; skips outputs a run didn't produce) - Guide: rewritten for newcomers, incl. samples vs analytical mean (#30) - Visitors are identified by an id in the URL (?v=...), carried on every link; runs are tagged with it, so visitors only see their own runs - Limits from the 'scenarios' config section: max samples, active runs per visitor and overall - Reuses the standard UI's results, progress and exposure components Removes the old Scenarios pages (pages/scenarios.py, scenariosGuide.py) and modules only they used, and the old guide screenshots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the hosted demo from the separate oasis-scenarios-*.yml stack to the installer stack (2.5.9, Traefik, HTTPS): - .env.scenarios: public demo template (OASIS_PUBLIC_DEMO=true, scenarios model set, simple auth, CHANGE_ME passwords) - docker-compose.public.yml (added when OASIS_PUBLIC_DEMO=true): the UI runs the Scenarios app; only Traefik's http/https ports are published and only the UI is routed (no public API, websocket, database or broker ports); a scenarios-prune service removes visitors' runs older than OASIS_PRUNE_DAYS, keeping showcase runs - docker-compose.acme.yml (added when OASIS_ACME_EMAIL is set): Let's Encrypt certificate for the public hostname - scenarios-setup one-shot (scripts/scenarios_setup.sh): loads portfolios, settings templates and showcase runs; idempotent, runs on every deploy - install.sh: --yes for unattended redeploys; refuses a public demo with non-simple auth or CHANGE_ME placeholders; public-aware summary - scripts: add_showcase_analyses.py (new); prune_analysis.py --keep-tag; add_settings_template.py updates an existing template instead of adding duplicates; add_test_portfolios.py skips portfolios whose files are missing - scenarios/deploy_scenarios_ui.sh (run by the CD workflow) now uses install.sh - Removes oasis-scenarios-platform.yml, oasis-scenarios-ui.yml and deploy-scenarios.sh (published the API on :8000 with default admin credentials and used :latest images) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scenarios-setup waited for a single model, so on a fresh deploy it went ahead as soon as PiWind registered and skipped the settings templates and showcase runs of scenario workers still starting up. It now waits for all 14 workers' models (SCENARIOS_MIN_MODELS), and carries on with whatever has registered if some never do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Starting every showcase run at once took down a 62GB laptop: each worker ran one Celery process per CPU, and each run used every core for the lookup and the loss calculation. - Scenario and showcase runs cap their processes (kernel_num_processes / lookup_num_processes) at scenarios.processes_per_run (default 2) - Scenario workers run one task at a time (OASIS_WORKER_CONCURRENCY, default 1) with a container memory limit (OASIS_WORKER_MEM_LIMIT, default 6g), so a run that outgrows it is killed in its container - Showcase runs are started one at a time (--max-concurrent), waiting for each to finish; failed or cancelled showcase runs are replaced - Site-wide concurrent visitor runs default to 3 (was 10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A generate-and-run passes through READY between input generation and the loss run. The showcase script took READY as finished and started the next scenario alongside it, and the Scenarios app could stop refreshing a visitor's progress and undercount active runs at that point. - add_showcase_analyses.py waits for a final status (completed, error, cancelled) - The Scenarios app counts a READY run updated in the last two minutes as still active (is_active), so a run stuck at READY doesn't block forever Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OasisPlatform's record_input_files always sets READY after input generation, ignoring its analysis_finish_status argument (generate-and-run passes RUN_STARTED). Until a worker picks up the loss run, the Analyses page stopped refreshing progress and offered a Run button for an analysis that was about to run anyway. The READY-grace rule from the Scenarios app moves to modules/status.py and is used by both apps: a READY analysis updated in the last two minutes counts as running, keeps progress refreshing, disables Run/Settings/Delete, and is labelled 'Inputs ready, starting run'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- install.sh: the CHANGE_ME check also matched the comment in .env.scenarios that mentions CHANGE_ME, so a public deploy was always refused even with every password set. Only settings lines are checked. - prune_analysis.py built its own APIClient without an auth type, which oasislmf 2.5.9 can't authenticate (server_info 403), so the daily prune retried for 30 minutes and never deleted anything. It now uses the shared service-account login (env vars, then secrets.toml), so the password is no longer passed on the command line where it showed in the process list. The prune service also runs Python unbuffered so its log appears. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It built and pushed coreoasis/oasis_scenarios, which nothing uses since the hosted demo is deployed with install.sh: scenarios/deploy_scenarios_ui.sh builds the UI image on the server from the checked-out code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Feedback from reviewing the Scenarios app: - Choosing a scenario: a filterable, sortable table (search, peril, country, provider, type) instead of text-heavy cards. Curated titles, perils, countries and types come from scenario_info in the Scenarios config, falling back to the exposure (OED peril and country names from the ods_tools OED spec). Fixes the missing Ghana-E760461 name (#28). - PiWind removed from the Scenarios set (worker, portfolios, template, model_map): it isn't a scenario - Sample results are the default in every output, with Analytical as the second option (MELT, MPLT, ALT/PALT, legacy ELT/AAL/PLT, comparisons) - MELT, SELT and QELT get an Event selector when there's more than one event, applied to the table and the map - Showcase runs break losses down by location (level 1, with maps) where the exposure has coordinates, plus the template's totals (level 2); add_showcase_analyses.py --replace rebuilds existing showcase runs - Visitor runs default to a location breakdown when the exposure can be mapped Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Treat 0,0 as not geocoded: one coordinate check (modules.oed.has_coordinates) for the maps, the showcase script and the run page's default breakdown - Showcase runs break losses down by location when the exposure has coordinates, else by country when it spans several (EUWS), and are named with the curated scenario title - Run summary as plain text, so long scenario names aren't truncated - Key the summary level selector by analysis, so its labels update when switching runs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Showcase runs left over from scenarios removed from the config (PiWind) no longer appear on the Showcase and Compare pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to map - Heatmaps centre and zoom on the locations with a loss, using the north-south as well as the east-west spread (Philippines-Taiwan was centred on open sea, zoomed too far in) - MELT, QELT, SELT and eltcalc only offer a Map tab when losses are grouped by location (with coordinates) or country, instead of 'No map to display.' Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scenario data lives with the scenarios: remove scenario_info from the UI config. Titles and descriptions come from each model's settings (updated in the Scenarios repo), peril and countries from its exposure. Drops the historical/synthetic type, which had no source in the scenario data. Showcase runs are labelled with their scenario's current name, so renaming a scenario doesn't need its showcase rebuilt. The test fixture's exposure and settings now match its Moroccan earthquake scenario. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A separate, credential-free Scenarios app for the public demo: newer users run pre-loaded disaster scenarios against pre-loaded exposure and explore the results, but cannot upload or delete anything. The hosted demo moves onto the installer stack, with only the UI exposed.
Closes the newcomer-explanation part of #30. PiWind is no longer one of the scenarios (13 scenarios).
Scenarios app (
scenarios_app.py, pages inscenarios_ui/)pages/comparison.py)Visitors are identified by an id in the URL (
?v=..., carried on every link and kept on reload); runs are tagged with it, so visitors only see their own runs plus the showcase. Limits (scenariossection ofscenarios/ui-config.json): max samples (50), active runs per visitor (2) and site-wide (3), processes per run (2).Locked down:
st.navigationregisters only the Scenarios pages, so the standard UI's pages (uploads, deletes) are not reachable from this app — requesting one falls back to the default page (tested).Results (both apps)
Public deployment on the installer stack
.env.scenariostemplate (OASIS_PUBLIC_DEMO=true, scenarios model set, simple auth,CHANGE_MEpasswords)docker-compose.public.yml: the UI runs the Scenarios app; only Traefik's 80/443 are published and only the UI is routed (no public API, websocket, database or broker ports — verified withdocker compose config); ascenarios-pruneservice removes visitors' runs afterOASIS_PRUNE_DAYS, keeping showcase runsdocker-compose.acme.yml(whenOASIS_ACME_EMAILis set): Let's Encrypt certificate for the public hostnamescenarios-setupone-shot: loads portfolios, settings templates and showcase runs; idempotent, runs every deployinstall.sh:--yesfor unattended redeploys; refuses a public demo with non-simple auth orCHANGE_MEplaceholdersscenarios/deploy_scenarios_ui.sh(run by the CD workflow) now usesinstall.shoasis-scenarios-platform.yml,oasis-scenarios-ui.ymlanddeploy-scenarios.sh(published the API on :8000 with default admin credentials,:latestimages), and the unusedscenarios-ui-docker.ymlworkflow (builtcoreoasis/oasis_scenarios, which nothing uses: the deploy builds the image on the server)Resource limits (from a local run that exhausted a 62 GB laptop)
Starting all 13 scenario showcase runs at once took the machine down: each worker ran one Celery process per CPU and each run used every core.
kernel_num_processes/lookup_num_processes(processes_per_run, default 2)OASIS_WORKER_CONCURRENCY=1and a container memory limitOASIS_WORKER_MEM_LIMIT=6gWith these, all the scenarios' showcase runs completed sequentially on the laptop, with ≥39 GB free throughout. The hosted server is smaller (t3a.2xlarge: 32 GB, 8 vCPU, root disk 85% full), so these limits matter there too.
Platform READY gap (OasisLMF/OasisPlatform#1506)
generate_and_runreportsREADYbetween input generation and the loss run (record_input_filesignoresanalysis_finish_status). Workaround in both apps (modules/status.py): aREADYanalysis updated in the last two minutes counts as running — progress keeps refreshing, Run/Settings/Delete stay disabled, and it's labelled "Inputs ready, starting run". The showcase script waits for a final status.Other changes
OASIS_SERVICE_USERNAME_OR_ID/OASIS_SERVICE_PASSWORD_OR_SECRET(set byinstall.shfrom.env), falling back tosecrets.toml, so credentials only live in.envtry/except);.parquetoutputs are foundTest plan
pytest— 140 passed (Scenarios app: visitor isolation, run flow, limits, process caps, navigation lockdown, showcase/compare; READY-gap handling in both apps).env.scenarioswith random passwords,ui.oasis.local): only 80/443 published; API, websocket, 51970, UI, database, broker, Redis and Traefik dashboard ports refused;/apinever reaches the platform; app authenticates with the.envpassword (thesecrets.tomlone is rejected); 14 scenarios listed; standard UI URLs fall back to the Scenarios app; a run completed over HTTPS; showcase runs one at a time; prune deleted a visitor run and kept all showcase runsFixed by the rehearsal: the installer's
CHANGE_MEcheck matched a comment in.env.scenarios, so every public deploy was refused; and the prune script couldn't authenticate with oasislmf 2.5.9 (no auth type), so it never deleted anything. Prune now uses the shared login, which also keeps the password out of the process list.Deploying to the hosted server (one-off)
The server already runs the installer stack, but on 2.5 images, an old branch, and
ui.oasis.local/http behind a separate nginx proxy. Moving to this setup needs its.envcreated from.env.scenarios, and a decision on whether Traefik terminates TLS (Let's Encrypt) or the existing nginx stays in front. Existing visitor analyses won't carry over; the showcase is rebuilt automatically. Check disk space first.🤖 Generated with Claude Code