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

Development of the concurrency control module for the new agent #39

Conversation

jr0me
Copy link
Member

@jr0me jr0me commented Jul 16, 2024

Description

This pull request introduces a foundational TaskManager class designed to meet the evolving needs of the Agent. The TaskManager can handle both thread-based and coroutine-based tasks, using Boost.Asio for asynchronous operations.

The class implements a generic interface, ITaskManager, allowing it to manage and execute tasks via an io_context. It supports enqueuing both standard function tasks and coroutine tasks, using boost::asio::co_spawn for the latter. This initial implementation serves as a starting point for developing a comprehensive task management system that will accommodate the Agent's future needs, integrating both threading and coroutine paradigms.

@jr0me jr0me force-pushed the enhancement/25-communicator-module-mvp branch from a683b33 to 1b4137c Compare July 16, 2024 15:40
@jr0me jr0me force-pushed the enhancement/24-design-and-development-of-the-concurrency-control-module-for-the-new-agent branch from aa7c114 to 1f1575d Compare July 17, 2024 05:58
@jr0me jr0me changed the base branch from enhancement/25-communicator-module-mvp to master July 17, 2024 05:58
This commit also defines the basic structure for
the cmake project and its subcomponents.

Test for each component should be built from the
parent folder using the -DBUILD_TESTS=1 option.

Inside the test folder a CMakeLists.txt file should
define the sources to be build, but always expecting
to be built from the parent CMake file.
@jr0me jr0me force-pushed the enhancement/24-design-and-development-of-the-concurrency-control-module-for-the-new-agent branch from 1f1575d to 8df565f Compare July 17, 2024 06:01
@jr0me jr0me changed the title Design and development of the concurrency control module for the new agent Development of the concurrency control module for the new agent Jul 17, 2024
@jr0me jr0me marked this pull request as ready for review July 17, 2024 06:06
@jr0me jr0me requested a review from TomasTurina July 17, 2024 13:37
Vcpkg as a submodule is introduced, the recommendation
is to set the vcpkg toolchain before the first call to project(),
due to some CMake requirements. This is because the toolchain
is evaluated during the call to project().
This class should be the starting point for a class whose
responsibility is going to be dealing with creating all the
Agent related tasks. We aim at supporting both multithreading
and coroutines as our concurrency model, but we allow to swap
coroutines implementations by templating the awaitable type.

Given the current status of the repository this will be momentarily
in the agent folder, but it would be wise to move it to a separate
cmake directory to hide the boost dependency for the implementation
here provided.
This implementation uses boost asio io_context and
awaitables. By enqueing either a callable object or
an awaitable, we delegate to the io_context to
schedule and manage the tasks within the pool.
@jr0me jr0me force-pushed the enhancement/24-design-and-development-of-the-concurrency-control-module-for-the-new-agent branch from 0b0ec46 to 1caf757 Compare July 17, 2024 17:19
These are implemented as coroutines using boost
asio and boost beast.

Current implementation loops when resumed
over a std::queue passed as reference and if
not empty, sends the contents making a http
request.
Copy link
Member

@TomasTurina TomasTurina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TomasTurina TomasTurina merged commit 604de06 into master Jul 17, 2024
2 checks passed
@TomasTurina TomasTurina deleted the enhancement/24-design-and-development-of-the-concurrency-control-module-for-the-new-agent branch July 17, 2024 20:57
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

Successfully merging this pull request may close these issues.

Design and development of the concurrency control module for the new agent
2 participants