Problem
The deduplication guard in DisciplineClient.get_partials_definitions never fires, because it compares a str against a list of PartialsMetaData messages.
philote_mdo/general/discipline_client.py (main, lines 162-164):
for message in self._disc_stub.GetPartialDefinitions(empty.Empty()):
if message.name not in self._partials_meta: # str vs list[PartialsMetaData]
self._partials_meta += [message]
Confirmed:
>>> meta = [data.PartialsMetaData(name="f", subname="x")]
>>> "f" not in meta
True
The condition is always true, so every message is appended unconditionally.
Consequence
Calling setup twice on one client appends the whole partials list again. _recover_partials then preallocates the same Jacobian block repeatedly, and declare_partials in the OpenMDAO binding (openmdao/utils.py:137-138) declares each pair more than once.
This is latent rather than active: nothing in the repo calls setup twice on a single client today. It becomes reachable as soon as a client is reused across jobs, which the job work makes a natural thing to want.
get_variable_definitions has the same append-rather-than-replace shape a few lines above, with no guard at all.
Proposed fix
Either compare on the identifying pair:
seen = {(m.name, m.subname) for m in self._partials_meta}
...
if (message.name, message.subname) not in seen:
or, more simply, clear both metadata lists at the start of each call so that a repeated setup replaces rather than accumulates. The second matches what the server does in Setup, which calls _clear_data() before rebuilding.
Notes
Found while tracing the client for #76. Pre-existing on main.
Problem
The deduplication guard in
DisciplineClient.get_partials_definitionsnever fires, because it compares astragainst a list ofPartialsMetaDatamessages.philote_mdo/general/discipline_client.py(main, lines 162-164):Confirmed:
The condition is always true, so every message is appended unconditionally.
Consequence
Calling setup twice on one client appends the whole partials list again.
_recover_partialsthen preallocates the same Jacobian block repeatedly, anddeclare_partialsin the OpenMDAO binding (openmdao/utils.py:137-138) declares each pair more than once.This is latent rather than active: nothing in the repo calls setup twice on a single client today. It becomes reachable as soon as a client is reused across jobs, which the job work makes a natural thing to want.
get_variable_definitionshas the same append-rather-than-replace shape a few lines above, with no guard at all.Proposed fix
Either compare on the identifying pair:
or, more simply, clear both metadata lists at the start of each call so that a repeated setup replaces rather than accumulates. The second matches what the server does in
Setup, which calls_clear_data()before rebuilding.Notes
Found while tracing the client for #76. Pre-existing on
main.