opcua-asyncio icon indicating copy to clipboard operation
opcua-asyncio copied to clipboard

How to pass the cache file to the server

Open rnestler opened this issue 3 years ago • 2 comments

In the docstring at https://github.com/FreeOpcUa/opcua-asyncio/blob/f2f7722d945dbbc04ab20a87f6aff17496f7edf1/asyncua/server/server.py#L58 and on the project documentation at https://pypi.org/project/asyncua/ it is mentioned that one can pass a cache file to the server to improve startup time.

But nowhere it is mentioned how to do this. Is this still possible? Or is the documentation just outdated and it isn't possible anymore?

rnestler avatar Apr 26 '22 14:04 rnestler

Sounds like the pickle file of the aspace which can be dumped/loaded. https://github.com/FreeOpcUa/opcua-asyncio/blob/cfe23db170473a0a8e28665c9f24c80b34fbde30/asyncua/server/address_space.py#L691

But tbh, I have never tried that way.

EDIT: But still, the doc at this place may be missleading

swamper123 avatar Apr 26 '22 14:04 swamper123

Looking into the source I saw that one can pass a shelf_file to init: https://github.com/FreeOpcUa/opcua-asyncio/blob/f2f7722d945dbbc04ab20a87f6aff17496f7edf1/asyncua/server/server.py#L107 and then passed to https://github.com/FreeOpcUa/opcua-asyncio/blob/f2f7722d945dbbc04ab20a87f6aff17496f7edf1/asyncua/server/address_space.py#L698 which writes the shelf file.

But on the second run it just hits the NotImplementedError when trying to load the shelf file again https://github.com/FreeOpcUa/opcua-asyncio/blob/f2f7722d945dbbc04ab20a87f6aff17496f7edf1/asyncua/server/address_space.py#L718

rnestler avatar Apr 26 '22 14:04 rnestler