Giter VIP home page Giter VIP logo

whatsopt-cli's Issues

Incompatibility with OpenMDAO 3.2+

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.