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

Explicitly signal stream initiation and termination #29

Merged
merged 11 commits into from
Aug 7, 2024

Conversation

NickCao
Copy link
Collaborator

@NickCao NickCao commented Aug 1, 2024

No description provided.


async with remote:
async for v in forward_server_stream(request_iterator, remote):
yield v

del self.resources[resource_uuid]
# del self.resources[resource_uuid]
# small resources might be fully buffered in memory
Copy link
Member

Choose a reason for hiding this comment

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

What do you mean by this?

Copy link
Collaborator Author

@NickCao NickCao Aug 6, 2024

Choose a reason for hiding this comment

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

Sequence of event:

  1. client opens a stream for sharing resource
  2. exporter accepts the stream and registers the other end of the stream as a resource
  3. exporter starts task to forward data from the client side of the stream to the exporter side of the stream
    3.1 (actually happened) stream is copied into internal buffer before being consumed, forward tasks exits, resource unregistered
  4. (originally intended) driver get the stream from the dict and begins consuming the stream
    4.1 (actually happened) driver fails to find resource
  5. (originally intended) stream is fully consumed by the driver, forward tasks exits, resource unregistered

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TLDR: resource shouldn't be unregistered when forwarding task exits, but only when it's fully consumed (or client decides to cancel)

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation I see now :-)

Copy link
Member

@mangelajo mangelajo left a comment

Choose a reason for hiding this comment

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

Looks great, just some comments about logging all "pass calls"

jumpstarter/common/streams.py Outdated Show resolved Hide resolved
jumpstarter/common/streams.py Outdated Show resolved Hide resolved
jumpstarter/common/streams.py Outdated Show resolved Hide resolved
@NickCao NickCao force-pushed the stream-termination branch from 57a9b39 to 2a3f62e Compare August 6, 2024 13:03
@mangelajo mangelajo merged commit 5793499 into main Aug 7, 2024
3 checks passed
@NickCao NickCao deleted the stream-termination branch August 7, 2024 13:52
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.

2 participants