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

[WIP] Trio based implementation of the Endpoint API #56

Closed

Conversation

pipermerriam
Copy link
Member

@pipermerriam pipermerriam commented May 10, 2019

blocked by #88

What was wrong?

WIP

Ugly things:

  • pytest-asyncio doesn't play nice in the test suite so I ended up having to segregate them.

How was it fixed?

Summary of approach.

Cute Animal Picture

put a cute animal picture link inside the parentheses

@pipermerriam
Copy link
Member Author

pytest-dev/pytest-asyncio#125 if accepted and released would allow us to condense the test runs back down.

lahja/_utils.py Outdated
import time


async def wait_for_path(path: pathlib.Path, timeout: int=2) -> None:
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: I can extract this change out of this PR

from lahja.trio.endpoint import TrioEndpoint


class BaseBackend(ABC):
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: extract this into a standalone PR to reduce scope of this PR

msg_data = pickle.dumps(message)
size = len(msg_data)
await self._socket.send_all(size.to_bytes(4, 'little'))
await self._socket.send_all(msg_data)
Copy link
Member Author

Choose a reason for hiding this comment

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

probably cheaper to combine these into a single send over the socket?

if msg_size_data == b'':
# probably in the process of being cancelled...
await trio.hazmat.checkpoint()
raise EOFError
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this should probably be converted to an internal lahja exception.

raise Exception("TODO: stream closed")
if len(msg_data) != msg_size:
# probably in the process of being cancelled...
await trio.hazmat.checkpoint()
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: I think this can be removed. as well as the other ones.

@pipermerriam pipermerriam force-pushed the piper/mirrored-trio-endpoint branch 3 times, most recently from 0656050 to 157f41b Compare May 22, 2019 21:05
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.

None yet

1 participant