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

Trouble loading ASharedMemoryContextManager. #5

Open
vladislavdonchev opened this issue Aug 8, 2024 · 0 comments
Open

Trouble loading ASharedMemoryContextManager. #5

vladislavdonchev opened this issue Aug 8, 2024 · 0 comments

Comments

@vladislavdonchev
Copy link

Hello,

Using Cengal 4.4.0, tested with python 3.11 and 3.10:

Following the shared_objects__example__sender.py, I am doing this:

    sso: dict = {"block_1": "TEST"}

    # Create shared memory manager
    memory = SharedMemory('shared_objects', create=True, size=16 * 1024 ** 3)  # 16GB
    memory_manager = ASharedMemoryManager(memory)

    async with memory_manager as asmm:
        print('Sender is ready.')

        # Each coroutine should get its own context manager (ASharedMemoryContextManager). Either `asmm` or `ashared_memory_manager` can be used
        memory_context_manager: ASharedMemoryContextManager = asmm()

        async with memory_context_manager as context_manager:
            with MeasureTimeTraceLine('Preparing the shared object and sending it to the receiver') as mt:
                sso_mapped: str = context_manager.value.put_message(sso)  # by default, for custom classes including dataclass, `sso` is `sso_mapped`

    printval('sso', sso)

Running the code with asyncio.run, what happens is that the 16Gs of memory space is allocated, but we never advance past memory_context_manager: ASharedMemoryContextManager = asmm()

Any suggestions / advice on how to trace the cause are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant