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

Errors in creating FlowsheetInterface from module and/or entry points do not result in test failures #1384

Open
lbianchi-lbl opened this issue May 11, 2024 · 1 comment
Assignees
Labels
fsapi Priority:Normal Normal Priority Issue or PR testing

Comments

@lbianchi-lbl
Copy link
Contributor

lbianchi-lbl commented May 11, 2024

Symptoms

  • This occurred most recently with the initial commits of Add LSRRO GUI #1383, where the only indication that some error had occurred was in the incomplete patch coverage (because the error occurred before the test of the test_flowsheet_interfaces tests could be run)
  • The error do show up in the output if running with pytest -s (disabling log capture)
2024-05-10 14:46:08 [ERROR] idaes.watertap.ui.fsapi: Cannot get FlowsheetInterface object for module '<module 'watertap.examples.flowsheets.lsrro.lsrro_ui' from '/home/ludo/lbl/watertap/watertap/watertap/examples/flowsheets/lsrro/lsrro_ui.py'>': 4 validation errors for FlowsheetExport
build_options.ROFiniteElements.value
  Value error, 'value' (10) not within expected range of [20-1] [type=value_error, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.NaClSolubilityLimit.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ConcentrationPolarization.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ROPressureDrop.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
2024-05-10 14:46:08 [ERROR] idaes.watertap.ui.fsapi: Cannot get FlowsheetInterface object for module '<module 'watertap.examples.flowsheets.lsrro.lsrro_ui' from '/home/ludo/lbl/watertap/watertap/watertap/examples/flowsheets/lsrro/lsrro_ui.py'>': 4 validation errors for FlowsheetExport
build_options.ROFiniteElements.value
  Value error, 'value' (10) not within expected range of [20-1] [type=value_error, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.NaClSolubilityLimit.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ConcentrationPolarization.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ROPressureDrop.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
2024-05-10 14:46:08 [ERROR] idaes.watertap.ui.fsapi: Cannot get FlowsheetInterface object for module '<module 'watertap.examples.flowsheets.lsrro.lsrro_ui' from '/home/ludo/lbl/watertap/watertap/watertap/examples/flowsheets/lsrro/lsrro_ui.py'>': 4 validation errors for FlowsheetExport
build_options.ROFiniteElements.value
  Value error, 'value' (10) not within expected range of [20-1] [type=value_error, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.NaClSolubilityLimit.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ConcentrationPolarization.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ROPressureDrop.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
2024-05-10 14:46:08 [ERROR] idaes.watertap.ui.fsapi: Cannot get FlowsheetInterface object for module '<module 'watertap.examples.flowsheets.lsrro.lsrro_ui' from '/home/ludo/lbl/watertap/watertap/watertap/examples/flowsheets/lsrro/lsrro_ui.py'>': 4 validation errors for FlowsheetExport
build_options.ROFiniteElements.value
  Value error, 'value' (10) not within expected range of [20-1] [type=value_error, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.NaClSolubilityLimit.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ConcentrationPolarization.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ROPressureDrop.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
2024-05-10 14:46:08 [ERROR] idaes.watertap.ui.fsapi: Cannot get FlowsheetInterface object for module '<module 'watertap.examples.flowsheets.lsrro.lsrro_ui' from '/home/ludo/lbl/watertap/watertap/watertap/examples/flowsheets/lsrro/lsrro_ui.py'>': 4 validation errors for FlowsheetExport
build_options.ROFiniteElements.value
  Value error, 'value' (10) not within expected range of [20-1] [type=value_error, input_value=10, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.NaClSolubilityLimit.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ConcentrationPolarization.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error
build_options.ROPressureDrop.value
  Value error, bool does not match the following criteria for values_allowed: must be either a list of possible values, or one of 'string', 'int', 'float'. [type=value_error, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error

Diagnosis

The cause for this is exceptions being caught and logged, whereas we should probably let these propagate up and handle the logging in clients:

watertap/watertap/ui/fsapi.py

Lines 1019 to 1025 in c2ee96c

try:
interface = func()
except Exception as err:
_log.error(
f"Cannot get FlowsheetInterface object for module '{module}': {err}"
)
return None

try:
module = ep.load()
except ImportError as err:
_log.error(f"Cannot import module '{module_name}': {err}")
continue

@lbianchi-lbl
Copy link
Contributor Author

This will most likely be addressed once we complete the migration of the watertap.ui.fsapi code to its own repository. When that's available (and the code has been removed from this repository) I'll transfer this issue over.

@lbianchi-lbl lbianchi-lbl added Priority:Normal Normal Priority Issue or PR and removed Priority:High High Priority Issue or PR labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fsapi Priority:Normal Normal Priority Issue or PR testing
Projects
None yet
Development

No branches or pull requests

2 participants