Skip to content

Should AbstractJob define __next__()? #5120

@mpharrigan

Description

@mpharrigan

AbstractJob provides an __iter__ method (currently just wraps a call to self.results() but default). I imagine this is to support a scheme where results can become available one at a time and you can consume them as they come in by using a for loop, for example.

I'm no expert, but I think we should also support calling next() on AbstractJobs for the same reason. Here's some docs: https://docs.python.org/3/library/stdtypes.html#iterator.__next__

In practice, I tried calling next() on a job and it said "E TypeError: 'SimulatedLocalJob' object is not an iterator"

cc @dstrain115

Metadata

Metadata

Assignees

Labels

area/googlearea/google/jobkind/design-issueA conversation around designtriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions