Skip to content

Add OetcSettings.from_env() and forward solver options through Model.solve()#612

Open
FabianHofmann wants to merge 5 commits intomasterfrom
feature/oetc-env-config-and-solver-forwarding
Open

Add OetcSettings.from_env() and forward solver options through Model.solve()#612
FabianHofmann wants to merge 5 commits intomasterfrom
feature/oetc-env-config-and-solver-forwarding

Conversation

@FabianHofmann
Copy link
Collaborator

@FabianHofmann FabianHofmann commented Mar 12, 2026

Changes proposed in this Pull Request

  • OetcSettings.from_env() classmethod: Support environement variables:

    • OETC_EMAIL, OETC_PASSWORD, OETC_AUTH_URL, OETC_ORCHESTRATOR_URL, OETC_NAME, OETC_SOLVER, OETC_SOLVER_OPTIONS, OETC_CPU_CORES, OETC_DISK_SPACE_GB, OETC_COMPUTE_PROVIDER, OETC_DELETE_WORKER_ON_ERROR
      -I know that is a lot, perhaps @KristijanFaust-OET can have a look which of them make sense to expose.
  • Forward solver_name and **solver_options from Model.solve() to the OETC handler: When calling m.solve(remote=handler, solver_name="gurobi", TimeLimit=100), solver options are now forwarded to solve_on_oetc() and merged with the settings-level options (call-time options take precedence). A merged copy is created each time to avoid mutating the handler's settings.

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

…solve()

- Add from_env() classmethod to OetcSettings for env var configuration
- Forward solver_name and solver_options from Model.solve() to OetcHandler
- Update _submit_job_to_compute_service to take explicit solver params
- Replace hasattr checks with direct attribute access
- Add 27 tests covering env var resolution, type parsing, and integration
@KristijanFaust-OET
Copy link
Contributor

@FabianHofmann
This doesn't remove the option to put these values in hte model config, right?

Not sure if it makes sense to expose OETC_SOLVER and OETC_SOLVER_OPTIONS since we should take those values from the model source config.

OETC_COMPUTE_PROVIDER can also be omitted for now, since we only support GCP at the moment, and exposing that option can only lead to input errors.

@FabianHofmann
Copy link
Collaborator Author

@FabianHofmann This doesn't remove the option to put these values in hte model config, right?

yes, they have lower priority

Not sure if it makes sense to expose OETC_SOLVER and OETC_SOLVER_OPTIONS since we should take those values from the model source config.

OETC_COMPUTE_PROVIDER can also be omitted for now, since we only support GCP at the moment, and exposing that option can only lead to input errors.

thanks for the quick message, removing those

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants