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

Go stateful DoFns user side changes #22761

Merged
merged 4 commits into from
Aug 18, 2022

Conversation

damccorm
Copy link
Contributor

@damccorm damccorm commented Aug 17, 2022

Adds all the user facing plumbing/validation/graph construction we need to make stateful DoFns work in Go. Follows the design laid out in https://docs.google.com/document/d/1rcKa1Z6orDDFr1l8t6NA1eLl6zanQbYAEiAqk39NQUU/edit?usp=sharing

I have the full version of this (not cleaned up and not quite 100% working on the talking to the state API side) in this PR - https://github.com/damccorm/beam/pull/70/files#diff-b2583776e71d93a9777a2ababf6ae018ff116c53c905486689aced60fdf44a4e - and was able to verify that it allows us to write a pipeline with a value state object and read to/write from that state. More work is needed to get the execution piece 100%.

This is the first part of #22736 which also has next steps laid out (see my first comment in that issue).


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@damccorm
Copy link
Contributor Author

Run Go PreCommit

@github-actions github-actions bot added the go label Aug 17, 2022
@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #22761 (cae00e9) into master (91c4b87) will decrease coverage by 0.06%.
The diff coverage is 43.38%.

@@            Coverage Diff             @@
##           master   #22761      +/-   ##
==========================================
- Coverage   74.20%   74.14%   -0.07%     
==========================================
  Files         710      711       +1     
  Lines       93547    93735     +188     
==========================================
+ Hits        69415    69498      +83     
- Misses      22855    22957     +102     
- Partials     1277     1280       +3     
Flag Coverage Δ
go 51.49% <43.38%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdks/go/pkg/beam/core/graph/edge.go 3.35% <ø> (ø)
sdks/go/pkg/beam/core/runtime/exec/translate.go 13.94% <0.00%> (-0.34%) ⬇️
sdks/go/pkg/beam/core/runtime/graphx/serialize.go 27.34% <0.00%> (-0.17%) ⬇️
sdks/go/pkg/beam/core/runtime/graphx/translate.go 41.58% <0.00%> (-0.88%) ⬇️
sdks/go/pkg/beam/pardo.go 44.44% <10.00%> (-2.97%) ⬇️
sdks/go/pkg/beam/core/runtime/exec/fn.go 67.48% <21.42%> (-2.07%) ⬇️
sdks/go/pkg/beam/core/funcx/fn.go 57.30% <31.25%> (-1.57%) ⬇️
sdks/go/pkg/beam/core/graph/fn.go 84.18% <67.24%> (-1.16%) ⬇️
sdks/go/pkg/beam/core/state/state.go 78.37% <78.37%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@damccorm
Copy link
Contributor Author

Run Go PreCommit

@damccorm damccorm marked this pull request as ready for review August 17, 2022 19:04
@damccorm
Copy link
Contributor Author

R: @riteshghorse

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @riteshghorse for label go.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

Copy link
Contributor

@riteshghorse riteshghorse left a comment

Choose a reason for hiding this comment

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

LGTM. Left a couple of comments but nothing blocking.

@@ -374,6 +390,8 @@ func New(fn reflectx.Func) (*Fn, error) {
kind = FnWindow
case t == typex.BundleFinalizationType:
kind = FnBundleFinalization
case t == state.ProviderType:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have the types for state and timers defined in typex package? I was thinking this for timers as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd probably vote we leave it as is unless there's a reason to switch - the typex package generally only exports types for structs it defines and IMO it makes sense to stay it in the state package to keep consistent with that. I don't feel super strongly though (@lostluck might have opinions too)

WriteValueState(val Transaction) error
}

type PipelineState interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc comment. Also fine if you are planning to add it in next PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I added one.

I may end up moving this to a different package when all is said and done (most likely when I have more execution focused state stuff) since I don't really want users implementing it. It will also eventually probably need some metadata about what state type should be used (ValueState in this case). Basically, its subject to change in my next PR(s) since it's more of an internals concept.

@damccorm damccorm merged commit 75eb0b1 into apache:master Aug 18, 2022
@damccorm damccorm deleted the users/damccorm/state-ux branch August 18, 2022 15:07
MarcoRob pushed a commit to MarcoRob/beam that referenced this pull request Sep 5, 2022
* Go stateful DoFns user side changes

* Fix static check violation

* Small cleanup

* Doc comments
dedocibula pushed a commit to dedocibula/beam that referenced this pull request Sep 15, 2022
* Go stateful DoFns user side changes

* Fix static check violation

* Small cleanup

* Doc comments
kkdoon pushed a commit to twitter-forks/beam that referenced this pull request Sep 29, 2022
* Go stateful DoFns user side changes

* Fix static check violation

* Small cleanup

* Doc comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants