Skip to content

feat(python): yield the items of a poll, with a resume point - #92

Draft
moetemp wants to merge 1 commit into
moe/up/varargs-unwrap-result-fieldfrom
moe/up/poll-items
Draft

moetemp wants to merge 1 commit into
moe/up/varargs-unwrap-result-fieldfrom
moe/up/poll-items

Conversation

@moetemp

@moetemp moetemp commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR lets a Python poll iterator yield the items of each page, with a point to resume from.

/// @nexus.poll python="next_read_request" items="records"
///   python-resume="resume_read_request" target="client"
read-records: func(request: read-records-request) -> read-records-response;
  • items="<field>" names a list field of the response, and the iterator yields its items.
  • python-resume= names an optional helper (page request, item) -> request that resumes after an item.
  • The iterator is a PollIterator. Its next_request resumes after the last item it yielded, and it's None after the last page.

The stream sample's read yields each Record. The poll-service feed yields its executions in Workflow code and in a client.

It's based on #89, and it's on the fork for review before an upstream PR.

Why?

The proposal reads Records one by one, and a reader saves its place to resume after a restart. With the page iterator of temporalio#325, each caller looped over the Records and kept the offset itself.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

The poll-service Workflow reads the feed's items through real Nexus endpoints.

`@nexus.poll items=` makes the iterator yield the items of each page, and `resume=` names the helper
that resumes after one item. The iterator's `next_request` lets a caller save its place.
@moetemp
moetemp force-pushed the moe/up/varargs-unwrap-result-field branch from bb29c8a to 56d99e2 Compare October 29, 2026 04:00
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.

1 participant