Skip to content

Send resolved OpenMDAO options to the server - #81

Merged
chrislupp merged 1 commit into
developfrom
bugfix/openmdao_opts
Aug 29, 2026
Merged

chrislupp merged 1 commit into
developfrom
bugfix/openmdao_opts

Conversation

@chrislupp

Copy link
Copy Markdown
Collaborator

Fixes #77.

Problem

RemoteExplicitComponent and RemoteImplicitComponent sent the raw constructor keyword arguments to the server, not the component's resolved options. Any option value that reached the component by another route never made it across:

  • an option left at its OpenMDAO default, and
  • an assignment after construction, such as comp.options['dimension'] = 10.

The failure was silent. The component reported the option as set, the server computed with a different one, and the results were wrong rather than erroneous.

Fix

A new utils.send_options(comp) builds the payload from comp.options, restricted to the names in comp._client.options_list so unrelated OpenMDAO options are not forwarded. Options that are declared but never assigned are skipped — declare_options gives them no default, so reading one raises, and leaving them out is what lets the server keep its own default.

client_setup calls it as its first act, immediately before run_setup().

On the re-send question

The issue asked whether a re-send belongs in setup() as well. The send moved there rather than being duplicated, and the constructor no longer sends anything.

Sending at construction cannot see post-construction assignment, so once setup sends, the constructor call is a redundant RPC that only ever carries a subset of the truth. Setup-time placement is also the only one that stays ahead of Setup by construction rather than by coincidence, which matters once #76 lands and SetOptions after Setup is refused with FAILED_PRECONDITION.

The cost: a server rejecting an option value now surfaces at prob.setup() instead of at construction. Nothing in the call path between the two needs options to be set, so nothing else moves.

Tests

  • tests/test_openmdao_utils.py — unit coverage for send_options: resolved values, unset options skipped, undeclared names filtered, and an ordering assertion that send_options precedes run_setup.
  • tests/test_openmdao_{explicit,implicit}_client.py — new ...ComponentOptions classes driving the real OpenMDAO option machinery against a mocked client, covering constructor kwargs, post-construction assignment, and unset options. The two constructor tests that pinned send_options(kwargs) now assert nothing is sent during construction.
  • tests/test_openmdao_integration.py — test_rosenbrock_option_set_after_construction builds with dimension=2, assigns 4, and checks the server's variable shape over real gRPC. It fails on the pre-fix code with (2,) != (4,).

Full suite: 324 passed.

Docs and CHANGELOG.md updated in the same commit.

RemoteExplicitComponent and RemoteImplicitComponent sent the raw
constructor keyword arguments to the server rather than the component's
resolved options. Any value that reached the component by another route
never reached the server: an OpenMDAO default, or an assignment such as
comp.options['dimension'] = 10 after construction. The failure was
silent, since the component reported the option as set while the server
kept computing with whatever it had.

The options are now read from comp.options, restricted to the names the
server declared through GetAvailableOptions so unrelated OpenMDAO
options are not forwarded, and transmitted from client_setup immediately
before the remote Setup call. Options declared without a value are
skipped, leaving the server on its own default.

The send moved out of the constructor rather than being duplicated. It
cannot see post-construction assignment, so once setup sends, the
constructor call is a redundant RPC carrying a subset of the truth.
Setup-time placement is also the only one that stays ahead of Setup by
construction rather than by coincidence, which matters for #76.
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
philote_mdo/openmdao/utils.py 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@chrislupp chrislupp self-assigned this Aug 29, 2026
@chrislupp chrislupp added the bug Something isn't working label Aug 29, 2026
@chrislupp chrislupp added this to the Version 0.9.0 milestone Aug 29, 2026
@chrislupp
chrislupp merged commit 497ab8a into develop Aug 29, 2026
7 of 8 checks passed
@chrislupp
chrislupp deleted the bugfix/openmdao_opts branch August 29, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant