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 SDK]: Enable fileio.MatchContinuously to emit duplicate file if modified #26524

Merged
merged 1 commit into from
May 15, 2023

Conversation

johannaojeling
Copy link
Contributor

Updates the fileio.MatchContinuously transform to support emission of duplicate matches if a file has been modified since it was last observed. The behavior is enabled by passing the fileio.MatchDuplicateAllowIfModified() option. Fixes #26523.


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

  • 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.

@johannaojeling
Copy link
Contributor Author

R: @lostluck

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

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

@lostluck
Copy link
Contributor

Thanks for your patience. I was on vacation towards the end of last week, and just caught up on things. Looking at this now.

Copy link
Contributor

@lostluck lostluck left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you.

Sorry for the delay. Some critical distractions occurred after my initial look.

}
}

return metadata, nil
}

func lastModified(ctx context.Context, fs filesystem.Interface, path string) (time.Time, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in this PR, but we could consider putting this as a helper function in the filesystem package instead, to allow more reasonable re-use and consistency in the implementation:

Eg. We implement copy, but if there's a Copier implementation, it can be used instead.
https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/io/filesystem/util.go#L55

We'd probably want a "creation time" too though when we do that, so the default isn't the zero time. Not critical at this stage though.

@lostluck lostluck merged commit 05eba4c into apache:master May 15, 2023
@lostluck
Copy link
Contributor

Oh dang, I will send a quick fix for this, but it looks like the time range might be incorrectly set for the local unit test:

Caught in another CL.

-- FAIL: TestLocal_lastModified (0.00s)
    local_test.go:177: LastModified("/tmp/TestLocal_lastModified2985575980/001/file.txt") = 2023-05-15 21:32:42.998867243 +0000 UTC, want in range [2023-05-15 21:32:43 +0000 UTC, 2023-05-15 21:32:43.004302634 +0000 UTC m=+0.001527498]
FAIL
	github.com/apache/beam/sdks/v2/go/pkg/beam/io/filesystem/local	coverage: 77.4% of statements
FAIL	github.com/apache/beam/sdks/v2/go/pkg/beam/io/filesystem/local	0.036s

@johannaojeling johannaojeling deleted the feat/fileio-emit-modified branch May 17, 2023 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Go SDK][Feature Request]: Allow fileio.MatchContinuously to emit duplicate matches for modified files
2 participants