-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[#29772][Go SDK] Add EventTime Timer tests. #29829
Conversation
Currently triggering all the post commits, so I can properly add filtering for failures. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #29829 +/- ##
==========================================
+ Coverage 38.23% 38.24% +0.01%
==========================================
Files 696 696
Lines 101878 101883 +5
==========================================
+ Hits 38952 38969 +17
+ Misses 61309 61299 -10
+ Partials 1617 1615 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
Yeah, just Dataflow appears to support timers. The others fail in various ways. |
Assigning reviewers. If you would like to opt out of this review, comment R: @jrmccluskey for label go. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
Friendly ping for a review here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI sdks/go/test/integration/integration.go
says at the top of the file:
// Running integration tests can be done with a go test call with any flags that
// are required by the test pipelines, such as --runner or --endpoint.
// Example:
//
// go test -v ./sdks/go/test/integration/... --runner=portable --endpoint=localhost:8099
which results in the error pattern ./sdks/go/test/integration/...: directory prefix sdks/go/test/integration does not contain main module or its selected dependencies
. This makes sense since there's no go.mod
at the root of the repos. I was able to execute this PR's branch in an ephemeral Google Cloud console using:
cd sdks
go test -v ./go/test/integration/... --runner=portable --endpoint=localhost:8099
However, I received the error:
2023/12/28 17:40:50 Cross-compiling /home/damondouglas/timerIntegrationTests/sdks/go/test/integration/wordcount/wordcount_test.go with GOOS=linux GOARCH=amd64 CGO_ENABLED=0 as /tmp/worker-1-1703785250974444350
wordcount_test.go:113: WordCount("foo") failed: connecting to job service
failed to dial server at localhost:8099
caused by:
context deadline exceeded
--- FAIL: TestWordCount (188.39s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1847fbc]
goroutine 23 [running]:
testing.tRunner.func1.2({0x1b951a0, 0x4abc560})
/usr/local/go/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1548 +0x397
panic({0x1b951a0?, 0x4abc560?})
/usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/apache/beam/sdks/v2/go/pkg/beam/runners/universal/runnerlib.universalPipelineResult.Metrics(...)
/timerIntegrationTests/sdks/go/pkg/beam/runners/universal/runnerlib/execute.go:164
github.com/apache/beam/sdks/v2/go/test/integration/wordcount.TestWordCount(0xc000500ea0)
/timerIntegrationTests/sdks/go/test/integration/wordcount/wordcount_test.go:116 +0x4b7
testing.tRunner(0xc000500ea0, 0x2582458)
/usr/local/go/src/testing/testing.go:1595 +0xff
created by testing.(*T).Run in goroutine 1
/usr/local/go/src/testing/testing.go:1648 +0x3ad
FAIL github.com/apache/beam/sdks/v2/go/test/integration/wordcount 188.507s
// TimersEventTime takes in an impulse transform and then validates | ||
// event time timer execution. | ||
// | ||
// The impulse is provided outside to swap between a bounded impulse, and | ||
// an unbounded one, because the Go SDK uses that to determine if a pipeline | ||
// is "streaming" or not. This matters at least for executions on Dataflow. | ||
// | ||
// Regardless,the pipelines should pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we consider the following? (Blame the comment lines alignment on the GitHub comment editor).
// Validator is a func that validates a Pipeline.
type Validator func(s beam.Scope)
// TimersEventTimeValidator produces a Validator that validates whether an OnTimer callback is invoked.
// It passert.EqualsList expected timestamps (as millisecond int) plus an expected offset.
//
// makeImp is a func that produces an impulse (either beam.Impulse or beam.PeriodicImpulse). The
// purpose of makeImp is to provide TimersEventTimeValidator either a bounded impulse or an
// unbounded one. Beam, in general, uses this impulse to determine if a pipeline is "streaming" or
// "batch". Test coverage for streaming or batch matters for executions on certain runners such as
// Dataflow.
func TimersEventTimeValidator(makeImp func(s beam.Scope) beam.PCollection) Validator {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Validator is actually constructing the pipeline. It's not validating a pipeline. The validation has to be built in. It's not clear what benefit the additional indirection through a type (which is still exposed as a
func(s beam.Scope)
anyway serves here, and it's not going to be obvious a "Validator" is actually the same as expected byptest.BuildAndRun
, even though the compiler is happy with it. -
I agree that the current TimersEventTime builder function isn't ideal. I'm going to unexport it, and simply move the full pipeline builds "internally", so it's not exposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you re-worded the comment. It's more clear now. Feel free to resolve this conversation if you'd like.
Great question! Fixing that is out of scope for this PR. integration.go does not start runners. The Go SDK has never auto-started runners, largely due to that being an undocumented expectation that has never been fulfilled. The lack of runner lead to deadline failure, and then retuning a nil Pipeline results. The test in particular doesn't fail out when there are nil PipelineResults though, so the metrics check then fails. This could be fixed by not returning a nil pipeline results in such cases in the default runner lib, or by making the test check if a nil was returned. |
Updated PTAL! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lostluck LGTM
Dataflow continues to pass, removing trigger files and merging. |
Add event time timer validation tests.
Execute both with bounded, and unbounded modes incase runners execute them differently (namely dataflow).
Fix bug in handling MapWindows, which couldn't map from Global Windows to GlobalWindows properly due to a quirk in the SDK's Window Coder + KV handling.
Pre-Work for #29772
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.