Update Julia Solver Dependencies and NLR API Key Environment Variables - #729
Conversation
To fix an issue that was identified in a REopt run, confirmed to be fixed by this update
There was a problem hiding this comment.
Pull request overview
This PR updates the Julia-side solver environment to newer versions (HiGHS/JuMP/MathOptInterface stack) and renames internally-used developer credential environment variables from NREL_* to NLR_* within julia_src, aligning with updated REopt.jl conventions.
Changes:
- Upgrade Julia solver stack dependencies and adjust the dependency graph in
julia_src/Manifest.toml(including adding MathOptIIS and removing some previously-used packages). - Rename internal developer key/email environment variables used by the Julia HTTP server (
julia_src/http.jl) and its.env. - Record the changes in
CHANGELOG.mdunderv3.22.1.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| julia_src/Manifest.toml | Upgrades solver stack packages (HiGHS/JuMP/MOI) and updates dependency resolution. |
| julia_src/http.jl | Renames env var usage for developer key/email and continues request-time key handling logic. |
| julia_src/.env | Renames env vars for local/default Julia server configuration. |
| CHANGELOG.md | Adds a v3.22.1 entry documenting the solver/env-var updates. |
Suppressed comments (1)
julia_src/http.jl:916
- Same concurrency issue as
/reopt: mutating globalENV["NLR_DEVELOPER_API_KEY"]inside the request handler can leak keys across concurrent requests. Prefer passing request-specific credentials explicitly (or otherwise isolating them) rather than relying on a process-global env var.
if !isempty(get(d, "api_key", ""))
ENV["NLR_DEVELOPER_API_KEY"] = pop!(d, "api_key")
else
ENV["NLR_DEVELOPER_API_KEY"] = test_nlr_developer_api_key
delete!(d, "api_key")
end
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const test_nlr_developer_api_key = ENV["NLR_DEVELOPER_API_KEY"] | ||
|
|
||
| ENV["NREL_DEVELOPER_EMAIL"] = "reopt@nlr.gov" | ||
| ENV["NLR_DEVELOPER_EMAIL"] = "reopt@nlr.gov" |
| NLR_DEVELOPER_API_KEY="gAfosXcQ9Ldfw3qXqvKVb7PxMEkYigozmC9R3mXQ" | ||
| NLR_DEVELOPER_EMAIL="reopt@nlr.gov" No newline at end of file |
| if !isempty(get(d, "api_key", "")) | ||
| ENV["NREL_DEVELOPER_API_KEY"] = pop!(d, "api_key") | ||
| ENV["NLR_DEVELOPER_API_KEY"] = pop!(d, "api_key") | ||
| else | ||
| ENV["NREL_DEVELOPER_API_KEY"] = test_nrel_developer_api_key | ||
| ENV["NLR_DEVELOPER_API_KEY"] = test_nlr_developer_api_key | ||
| delete!(d, "api_key") |
rathod-b
left a comment
There was a problem hiding this comment.
Need to merge conflicts in Changelog.md, rest looks good!
|
Reverted: the merge commit was rolled back off |
This pull request makes two unrelated updates:
julia_srcfolder) for the optimization solver stack (HiGHS, JuMP, MathOptInterface). We had found peculiar optimization results for a scenario with tiered rates where it was solving with a negative NPV of larger magnitude than the tolerance. The solver stack upgrade fixed it. It also removes some unused dependencies.Environment variable renaming:
NREL_DEVELOPER_API_KEYandNREL_DEVELOPER_EMAILtoNLR_DEVELOPER_API_KEYandNLR_DEVELOPER_EMAILin thejulia_srcdirctory.envfile andhttp.jlwhich uses that. This affects how API keys and emails are loaded and set for requests. [1] [2] [3] [4]Dependency updates and removals:
Manifest.toml, includingHiGHS(from 1.15.0 to 1.24.1),HiGHS_jll,JuMP(from 1.25.0 to 1.31.1), andMathOptInterface(from 1.39.0 to 1.52.0), and added new dependencies such asMathOptIIS. [1] [2] [3]BenchmarkTools,JSON3,Profile, andStructTypesfromManifest.toml, cleaning up the dependency tree. [1] [2] [3] [4]