Skip to content

refactor(framework) Convert Driver.pull_messages to no-arg#5067

Closed
chongshenng wants to merge 22 commits intomainfrom
refactor/no-arg-driver-pull-msg
Closed

refactor(framework) Convert Driver.pull_messages to no-arg#5067
chongshenng wants to merge 22 commits intomainfrom
refactor/no-arg-driver-pull-msg

Conversation

@chongshenng
Copy link
Member

@chongshenng chongshenng commented Mar 12, 2025

This PR adds the return of an iterator for the Driver.pull_messages().

@chongshenng chongshenng marked this pull request as ready for review March 13, 2025 14:11
Comment on lines +181 to +184
def iter_msg() -> Iterator[Message]:
return iter(message_res_list)

return iter_msg()
Copy link
Member

Choose a reason for hiding this comment

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

Both Iterator and list are acceptable types of Iterable. Since we already have a list of messages, we don't need to convert it to an iterator here.

@jafermarq Should we also update the in memory driver so it really returns an iterator and doesn't pull all messages at once? Wdyt?

Suggested change
def iter_msg() -> Iterator[Message]:
return iter(message_res_list)
return iter_msg()
return message_res_list

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we also update the in memory driver so it really returns an iterator and doesn't pull all messages at once? Wdyt?

Indeed, that was the original idea - to keep the return behaviour the same for both in-memory driver and the grpc_driver.

@chongshenng chongshenng marked this pull request as draft March 13, 2025 16:44
@github-actions github-actions bot added the Contributor Used to determine what PRs (mainly) come from external contributors. label May 22, 2025
@WilliamLindskog WilliamLindskog added Maintainer Used to determine what PRs (mainly) come from Flower maintainers. and removed Contributor Used to determine what PRs (mainly) come from external contributors. labels May 23, 2025
@chongshenng
Copy link
Member Author

Closing as this is stale.

@chongshenng chongshenng deleted the refactor/no-arg-driver-pull-msg branch August 14, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintainer Used to determine what PRs (mainly) come from Flower maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants