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

Replace websockets with zmq #9173

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Replace websockets with zmq #9173

wants to merge 6 commits into from

Conversation

xjules
Copy link
Contributor

@xjules xjules commented Nov 11, 2024

Issue

  • POC: testing feasibility of zmq.

  • Refactor tests

Approach
Implementing router-dealer pattern with custom acknowledgments with zmq

  • Server / router (ensemble evaluator) gets messages and keeps track of connected clients wherein in additional it sends ack message to dispachers to confirm that the message has been received .

  • Dealer(s) = clients and dispatchers are sending messages to the router via:

send_multipart([b""] + [message.encode("utf-8") for message in messages])

which essentially batching multiple messages into one.

  • dispatcher now send messages in chunks

  • dispatcher always waits for acknowledgement from the evaluator

  • removing websockets, no more wait_for_evaluator

  • Setup encryption with curve

  • each dealer (client, dispatcher) will get a unique name

  • PR title captures the intent of the changes, and is fitting for release notes.

  • Added appropriate release note label

  • Commit history is consistent and clean, in line with the contribution guidelines.

  • Make sure unit tests pass locally after every commit (git rebase -i main --exec 'pytest tests/ert/unit_tests -n logical -m "not integration_test"')

When applicable

  • When there are user facing changes: Updated documentation
  • New behavior or changes to existing untested code: Ensured that unit tests are added (See Ground Rules).
  • Large PR: Prepare changes in small commits for more convenient review
  • Bug fix: Add regression test for the bug
  • Bug fix: Create Backport PR to latest release

@xjules xjules self-assigned this Nov 11, 2024
@xjules xjules force-pushed the test_zmq branch 3 times, most recently from feac786 to 5acae39 Compare November 19, 2024 14:58
@xjules xjules marked this pull request as ready for review November 19, 2024 14:59
@@ -55,84 +51,83 @@ def __init__(
cert: Optional[Union[str, bytes]] = None,
max_retries: Optional[int] = None,
timeout_multiplier: Optional[int] = None,
dealer_name: str | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Too keep it the same style as the other parameters

Suggested change
dealer_name: str | None = None,
dealer_name: Optional[str] = None,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to be "modern", but will make it the same then :)

Comment on lines 249 to 255
else:
event = event_from_json(raw_msg)
if type(event) is EEUserCancel:
logger.debug("Client asked to cancel.")
self._signal_cancel()
elif type(event) is EEUserDone:
logger.debug("Client signalled done.")
self.stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have to ACK messages from the monitor/client, or is it self acknowledging when it sees the EE stopping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've decided not to do acknowledgements between the client and evaluator, since it is dispatchers that are problematic. But time will tell...

@xjules xjules force-pushed the test_zmq branch 5 times, most recently from e553dbc to 016b43d Compare November 21, 2024 13:25
 - dispatcher now send messages in chunks
 - dispatcher always for acknolwedgment from the evaluator
 - removing websockets, no more wait_for_evaluator
 - Settup encryption with curve
 - each dealer (client, dispatcher) will get a unique name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants