Skip to content

[BEAM7473] [BEAM8478] Update SDF related APIs - #9794

Merged
boyuanzz merged 1 commit into
apache:masterfrom
boyuanzz:watermark
Nov 13, 2019
Merged

boyuanzz merged 1 commit into
apache:masterfrom
boyuanzz:watermark

Conversation

@boyuanzz

@boyuanzz boyuanzz commented Oct 14, 2019 •

Copy link
Copy Markdown
Contributor

API changes included:

  • Create WatermarkEstimator for tracking watermark.

  • Use try_split(0) as checkpoint and delete checkpoint API.

  • Create ThreadsafeRestrictionTracker which wraps a RestrictionTracker to provide synchronization.

  • Create RestrictionTrackerView to limit API expose to a DoFn.

OffsetRestrictionTracker changes:

  • Clean up lock logic

  • Clean up checkpoint()

Proto changes:

  • Add a new field into DelayedBundleApplication: google.protobuf.Duration requested_time_delay

R: @robertwb
cc: @lukecwik

@boyuanzz boyuanzz changed the title Watermark [WIP] Update SDF watermark API with WatermarkEstimator & WatwrmarkEstimatorParam Oct 14, 2019
@boyuanzz
boyuanzz force-pushed the watermark branch 6 times, most recently from d856017 to a34b71a Compare October 24, 2019 22:41
@boyuanzz boyuanzz changed the title [WIP] Update SDF watermark API with WatermarkEstimator & WatwrmarkEstimatorParam [7473] [8478] Update SDF related APIs Oct 24, 2019
@boyuanzz
boyuanzz requested a review from robertwb October 24, 2019 22:56
@boyuanzz boyuanzz changed the title [7473] [8478] Update SDF related APIs BEAM[7473] BEAM[8478] Update SDF related APIs Oct 24, 2019
@boyuanzz boyuanzz changed the title BEAM[7473] BEAM[8478] Update SDF related APIs [BEAM7473] [BEAM8478] Update SDF related APIs Oct 25, 2019
@boyuanzz

Copy link
Copy Markdown
Contributor Author

Run Python Precommit

@asf-ci

asf-ci commented Oct 28, 2019

Copy link
Copy Markdown

SUCCESS

--none--

@boyuanzz

Copy link
Copy Markdown
Contributor Author

Kindly pinged : )

@robertwb robertwb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. I've left some comments. The least fleshed out seems WatermarkEstimator, but I don't think we have to resolve that before getting the other stuff in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While I think it makes sense to allow both in the public API, I generally try to avoid such redundancy in the internal implementation. However, it may be OK in this case given neither is clearly better. Any thoughts @lukecwik ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I created a JIRA issue as follow up: BEAM-8536. Maybe it would be better to separate this PR from java changes?

Comment thread sdks/python/apache_beam/io/iobase.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't expose ThreadsafeRestrictionTracker and RestrictionTrackerView as public--users shouldn't be creating these. (One could argue perhaps the latter, for documentation purposes.)

Comment thread sdks/python/apache_beam/io/iobase.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would put this note down below "Keeps track of the restrictions claimed part for a Splittable DoFn." as it's not the most important thing about this class.

Also, to be completely clear, I might phrase it as

The restriction may be modified by different threads, however the system will ensure sufficient locking such that no methods on the restriction tracker will be called concurrently.

Comment thread sdks/python/apache_beam/io/iobase.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The runner can...

Comment thread sdks/python/apache_beam/io/iobase.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm... Looking at this in context it seems out-of-place. I would remove this from RestrctionTracker and suggest the implementation(s) be placed in RestrictionProvider instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not done?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed default_size from RestrictionTracker in commit: 786fb3c. There is another API called restriction_size() in RestrictionProvider, which is duplicated with default_size.

Comment thread sdks/python/apache_beam/io/iobase.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if we should require the user to implement this at all. Perhaps it should just be part of the RestrictionTrackerView, whose implementation is try_split(0), marking self as done, and populating that which needs to be returned for deferred_status.

Comment thread sdks/python/apache_beam/io/iobase.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fact that we have to do this seems like a flaw in our API... Can we not get this information out of current_restriction()?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not resolved?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry, I actually did the replacement in commit a1fc6fc but I forgot to delete original one. Deleted here: e89287c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Extra space after """

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be set_watermark?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should flesh out what the interface is for a general WatermarkEstimator, vs. this particular ManualWatermarkEstimator with this particular implementation. This may inform whether we want a WatermarkEstimatorProvider or an actual WatermarkEstimator instance (which we repeatedly call reset() on.) A TODO would be fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Created BEAM-8537. I'll follow up with this one after merging this PR.

@boyuanzz

boyuanzz commented Nov 1, 2019 •

Copy link
Copy Markdown
Contributor Author

All above comments have been addressed. I'll merge conflicts once changes look fine.
Please take another look @robertwb Thanks!

@boyuanzz

boyuanzz commented Nov 6, 2019

Copy link
Copy Markdown
Contributor Author

Run Portable_Python PreCommit

@robertwb robertwb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just some more references to default_size to remove, then it looks good.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove this test?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should remove its use as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move up to the restriction provider(s).

@boyuanzz

boyuanzz commented Nov 8, 2019

Copy link
Copy Markdown
Contributor Author

Run Python PreCommit

@boyuanzz

boyuanzz commented Nov 8, 2019

Copy link
Copy Markdown
Contributor Author

Thanks for your help, Robert! I have cleaned up all default_size in commit 712d95e. @robertwb

@boyuanzz

Copy link
Copy Markdown
Contributor Author

Kindly pinged : D

@robertwb robertwb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like there's some merge conflicts, but other than that looks good to me. Thanks.

@boyuanzz

Copy link
Copy Markdown
Contributor Author

Run Python PreCommit

@boyuanzz

Copy link
Copy Markdown
Contributor Author

Run Java PreCommit

@boyuanzz

Copy link
Copy Markdown
Contributor Author

Run Python PreCommit

@boyuanzz

Copy link
Copy Markdown
Contributor Author

Run Python PreCommit

@boyuanzz
boyuanzz merged commit 352ecf3 into apache:master Nov 13, 2019
@pabloem

pabloem commented Nov 13, 2019

Copy link
Copy Markdown
Member

fyi @rohdesamuel

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.

4 participants