You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because Reasons:tm: (just don't ask), I was able to get some Weird errors from Oso that I believe stems from multiple parallel initializations.
...
File "/myapp/core.py", line 145, in _register_models
oso.register_class(model, name=model.__name__)
File "/usr/local/lib/python3.8/site-packages/polar/polar.py", line 253, in register_class
self.host.register_mros()
File "/usr/local/lib/python3.8/site-packages/polar/host.py", line 122, in register_mros
for rec in self.distinct_user_types():
RuntimeError: dictionary changed size during iteration
polar.exceptions.PolarRuntimeError: Cannot load additional Polar code -- all Polar code must be loaded at the same time.
def get_oso():
"""
Get the oso object
"""
global OSO
if OSO is None:
OSO = Oso()
app = get_base_app()
# Add config as constants
for name, value in app.config.items():
OSO.register_constant(value, name)
# Note: This is handled automatically if you use oso-sqlalchemy
import myapp.models
_register_models(OSO, myapp.models.Base)
import myapp.osolib
OSO.register_constant(myapp.osolib, 'lib')
# https://github.com/osohq/oso/issues/1435
OSO.load_resources([
('myapp', res)
for res in importlib.resources.contents('myapp')
if res.endswith('.polar')
])
return OSO
The text was updated successfully, but these errors were encountered:
Because Reasons:tm: (just don't ask), I was able to get some Weird errors from Oso that I believe stems from multiple parallel initializations.
The text was updated successfully, but these errors were encountered: