Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with OpenMDAO 3.2+ #11

Closed
christophe-david opened this issue Sep 9, 2020 · 0 comments · Fixed by #12
Closed

Incompatibility with OpenMDAO 3.2+ #11

christophe-david opened this issue Sep 9, 2020 · 0 comments · Fixed by #12

Comments

@christophe-david
Copy link

It looks like the new auto-ivc feature of OpenMDAO 3.2 breaks things in wop.

Provided you have already connected once to WhatsOpt server, the following snippet should work with OpenMDAO 3.1 but should break with OpenMDAO 3.2 or 3.3.
Uncommenting the line that adds the IVC to the group makes the script work again.
Also, the code works in all case if components are added directly in problem.model with no additional group added.

import openmdao.api as om
from whatsopt.show_utils import generate_xdsm_html
from whatsopt.whatsopt_client import WhatsOpt


class SomeComponent(om.ExplicitComponent):
    def setup(self):
        self.add_input("foo")
        self.add_output("bar")

    def compute(self, inputs, outputs, discrete_inputs=None, discrete_outputs=None):
        outputs["bar"] = inputs["foo"]


problem = om.Problem()

ivc = om.IndepVarComp()
ivc.add_output("foo", 10.0)

group = om.Group()
# group.add_subsystem("ivc", ivc, promotes=["*"])
group.add_subsystem("comp", SomeComponent(), promotes=["*"])
problem.model.add_subsystem("group", group, promotes=["*"])

problem.setup()
problem.final_setup()

wop = WhatsOpt(login=False)
ok = wop.login(echo=False)
if ok:
    xdsm = wop.push_mda(
        problem, {"--xdsm": True, "--name": "dummy_test", "--dry-run": False, "--depth": 1}
    )
    generate_xdsm_html(xdsm, "xdsm.html")

Error message:

Traceback (most recent call last):
  File "/Volumes/MacHD2/Users/tof/PycharmProjects/FAST-OAD/results/xdsm_test.py", line 45, in <module>
    problem, {"--xdsm": True, "--name": "dummy_test", "--dry-run": False, "--depth": 1}
  File "/Volumes/MacHD2/Users/tof/PycharmProjects/FAST-OAD/.venv/lib/python3.7/site-packages/whatsopt/whatsopt_client.py", line 262, in push_mda
    problem.model, push_cmd.tree, use_depth=True
  File "/Volumes/MacHD2/Users/tof/PycharmProjects/FAST-OAD/.venv/lib/python3.7/site-packages/whatsopt/push_command.py", line 34, in get_mda_attributes
    self._collect_disc_infos(self.problem.model, self.tree)
  File "/Volumes/MacHD2/Users/tof/PycharmProjects/FAST-OAD/.venv/lib/python3.7/site-packages/whatsopt/push_command.py", line 262, in _collect_disc_infos
    self._collect_disc_infos(system._subsystems_myproc[i], child, prefix)
  File "/Volumes/MacHD2/Users/tof/PycharmProjects/FAST-OAD/.venv/lib/python3.7/site-packages/whatsopt/push_command.py", line 265, in _collect_disc_infos
    if not isinstance(system._subsystems_myproc[i], IndepVarComp):
IndexError: list index out of range
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 a pull request may close this issue.

1 participant