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

MultiBmi's root validator does not consider that passed in module could be a pydantic model object #62

Closed
aaraney opened this issue Jul 24, 2023 · 2 comments · Fixed by #63
Assignees
Labels
bug Something isn't working

Comments

@aaraney
Copy link
Member

aaraney commented Jul 24, 2023

modules = values.get('modules')
if not name and modules:
try:
names = [ m['params']['model_name'] for m in modules ]
except KeyError:
names = [ m['params']['model_type_name'] for m in modules ]
values['model_name'] = '_'.join( names )

@aaraney aaraney added the bug Something isn't working label Jul 24, 2023
@aaraney aaraney self-assigned this Jul 24, 2023
@aaraney
Copy link
Member Author

aaraney commented Jul 24, 2023

This should fix it:

        if not name and modules:
            names = []
            for m in modules:
                if isinstance(m, Formulation):
                    names.append(m.params.model_name)
                else:
                    try:
                        names.append(m['params']['model_name'])
                    except KeyError:
                        names.append(m['params']['model_type_name'])
            values['model_name'] = '_'.join( names )
        return values

@aaraney
Copy link
Member Author

aaraney commented Jul 24, 2023

See the this runner test failure for an example: https://github.com/NOAA-OWP/ngen-cal/actions/runs/5648093629/job/15299557714#step:7:45

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 a pull request may close this issue.

1 participant