Skip to content

WebSocket streaming alignment & deprecation fixes#268

Open
AHReccese wants to merge 13 commits intodevfrom
enhance/websocket
Open

WebSocket streaming alignment & deprecation fixes#268
AHReccese wants to merge 13 commits intodevfrom
enhance/websocket

Conversation

@AHReccese
Copy link
Member

Reference Issues/PRs

What does this implement/fix? Explain your changes.

  • Aligned WebSocket protocol with REST API (client registration, model management, access control)
  • Added scenario4 test for access control features on both protocols
  • Fixed REST get_allowance returning 404 on empty allowances
  • Fixed numpy and datetime deprecation warnings
  • Added proper connection cleanup to PymiloClient and WebSocketClientCommunicator

Any other comments?

@AHReccese AHReccese added this to the pymilo v1.6 milestone Mar 3, 2026
@AHReccese AHReccese self-assigned this Mar 3, 2026
@AHReccese AHReccese added enhancement New feature or request test new feature labels Mar 3, 2026
…and PymiloClient

Updated the close method documentation for clarity and streamlined the destructor logic to remove unnecessary try-except blocks. This enhances readability and ensures proper resource management during object destruction.
…mments

Improved the cleanup process in the WebSocketClientCommunicator by ensuring the event loop is checked before attempting to disconnect. Additionally, clarified comments in the test file regarding the loading of JSON data for better understanding.
@AHReccese AHReccese requested a review from sadrasabouri March 3, 2026 22:36
@AHReccese AHReccese added the major major changes, to be reviewed in 10 days label Mar 3, 2026
Copy link
Member

@sadrasabouri sadrasabouri left a comment

Choose a reason for hiding this comment

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

I left two comments which is applicable throughout the PR. Can you please fix them and request review me again?

@AHReccese AHReccese requested a review from sadrasabouri March 4, 2026 18:27
Copy link
Member

@sadrasabouri sadrasabouri left a comment

Choose a reason for hiding this comment

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

I reviewed it again and it required some more changes throught the PR.

:param client_id: ID of the client
:param model_id: ID of the model
:param model: serialized model content
:return: True if upload was successful, False otherwise
Copy link
Member

Choose a reason for hiding this comment

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

We also remove the returns in the new docstring formats.

response = self.loop.run_until_complete(
self.send_message("remove_client", {"client_id": client_id})
)
return "error" not in response
Copy link
Member

Choose a reason for hiding this comment

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

self._check_response_error(response) ?

Register ML model in the PyMiloServer.

:param client_id: id of the client who owns the model
:type client_id: str
Copy link
Member

Choose a reason for hiding this comment

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

you missed this from the last round of edition ig.

"ml_model_id": model_id,
})
)
return "error" not in response
Copy link
Member

Choose a reason for hiding this comment

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

self._check_response_error(response) ?

Copy link
Member

Choose a reason for hiding this comment

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

this happens other places as well. Please fix it all over the PR.


:param websocket: the WebSocket connection to remove.
:type websocket: webSocket
:type websocket: WebSocket
Copy link
Member

Choose a reason for hiding this comment

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

this as well.

payload["client_id"],
payload["ml_model_id"],
),
"message": f"Download request from client: {client_id} for model: {ml_model_id}",
Copy link
Member

Choose a reason for hiding this comment

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

move this to params if possible.

result = self._ps.execute_model(call_payload)
return {
"message": "Attribute call executed.",
"message": f"Attribute call request from client: {client_id} for model: {ml_model_id}",
Copy link
Member

Choose a reason for hiding this comment

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

move to params.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request major major changes, to be reviewed in 10 days new feature test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants