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

Multipacket #186

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Multipacket #186

wants to merge 3 commits into from

Conversation

GwendalRaoul
Copy link
Contributor

Brief description

Implement collection of generic message.

  • Gateway is able to group received message
  • Gateway can receive multiple requests at the same time

For now groups are defined in the code directly for testing purpose. Dynamic config will be added in one of the next steps.

This change required the PR: wirepas/backend-apis#124

Remaining items

  • .Add grouping configuration (from API and config file)

  • Save group config in case of restart

  • Define the final topics for collection message

  • Fix synchro in packet queue to avoid group of messages exceeding the max number of element

  • Try to determine the final size of a packet group without serializing the message to avoid too much computing (with some margin)

GwendalRaoul and others added 3 commits July 31, 2020 18:10
This is still WIP.
In order to test a new wheel must be generated for wirepas messaging based
on PR
It is needed to reuse same code to handle multiple packets
def _on_collection_message_received(self, client, userdata, message):
self.logger.info("Collection message received")
try:
collection_message = wirepas_messaging.gateway.api.GenericCollection.from_payload(
Copy link

Choose a reason for hiding this comment

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

line too long (94 > 79 characters)

# pylint: disable=unused-argument
self.logger.info("OTAP process request received")
try:
request = wirepas_messaging.gateway.api.ProcessScratchpadRequest.from_payload(
Copy link

Choose a reason for hiding this comment

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

line too long (90 > 79 characters)

try:
request = wirepas_messaging.gateway.api.ProcessScratchpadRequest.from_payload(
request = wirepas_messaging.gateway.api.UploadScratchpadRequest.from_payload(
Copy link

Choose a reason for hiding this comment

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

line too long (89 > 79 characters)

try:
request = wirepas_messaging.gateway.api.UploadScratchpadRequest.from_payload(
request = wirepas_messaging.gateway.api.GetScratchpadStatusRequest.from_payload(
Copy link

Choose a reason for hiding this comment

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

line too long (92 > 79 characters)

try:
request = wirepas_messaging.gateway.api.SetConfigRequest.from_payload(
request = wirepas_messaging.gateway.api.GetGatewayInfoRequest.from_payload(
Copy link

Choose a reason for hiding this comment

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

line too long (87 > 79 characters)

# pylint: disable=unused-argument
self.logger.info("Set config request received")
"""
This function doesn't need the decorator @deferred_thread as request is handled
Copy link

Choose a reason for hiding this comment

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

line too long (87 > 79 characters)


if send:
# TODO list can contain more than max packets. Should be tested somwhere
if self.on_packets_ready_cb(self._messages_list, self.filter_name):
Copy link

Choose a reason for hiding this comment

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

line too long (87 > 79 characters)

send = True

if send:
# TODO list can contain more than max packets. Should be tested somwhere
Copy link

Choose a reason for hiding this comment

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

line too long (92 > 79 characters)


def run(self):
"""
Main queue loop that is in charge of creating and sending the packet when needed
Copy link

Choose a reason for hiding this comment

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

line too long (88 > 79 characters)

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.

1 participant