Skip to content

Broken gridDist in PICMI #5567

@pordyna

Description

@pordyna

#5502 broke with c9c2f97 setting grid distirbution in PICMI.

Since #5502 a gridDist different than None will result in an error like:

jsonschema.exceptions.ValidationError: {'x': [{'device_cells': 464}, {'device_cells': 456}, {'device_cells': 456}, {'device_cells': 456}, {'device_cells': 464}, {'device_cells': 456}, {'device_cells': 456}, {'device_cells': 456}], 'y': [{'device_cells': 1176}, {'device_cells': 1176}, {'device_cells': 1176}, {'device_cells': 1168}], 'z': [{'device_cells': 64}]} is not valid under any of the given schemas

Failed validating 'anyOf' in schema['properties']['grid_dist']:
    {'anyOf': [{'maxItems': 3,
                'minItems': 3,
                'prefixItems': [{'items': {'type': 'integer'},
                                 'type': 'array'},
                                {'items': {'type': 'integer'},
                                 'type': 'array'},
                                {'items': {'type': 'integer'},
                                 'type': 'array'}],
                'type': 'array'},
               {'type': 'null'}],
     'default': None,
     'title': 'Grid Dist'}

On instance['grid_dist']:
    {'x': [{'device_cells': 464},
           {'device_cells': 456},
           {'device_cells': 456},
           {'device_cells': 456},
           {'device_cells': 464},
           {'device_cells': 456},
           {'device_cells': 456},
           {'device_cells': 456}],
     'y': [{'device_cells': 1176},
           {'device_cells': 1176},
           {'device_cells': 1176},
           {'device_cells': 1168}],
     'z': [{'device_cells': 64}]}

Adding back the old schema with

git checkout 30531894b649e39ec5adf9d0c3f79b3256ad80ca -- share/picongpu/pypicongpu/schema/grid.Gri
d3D.json

"fixes" the issue.

It looks like the pydantic generates a wrong schema for this class. It ignores the change in the structure that is happening in serialization.

Metadata

Metadata

Assignees

Labels

PICMIpypicongpu and picmi relatedbuga bug in the project's code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions