-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[BEAM-12988] [Playground] Add FileSystem service #15645
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
[BEAM-12988] [Playground] Add FileSystem service #15645
Conversation
|
R: @pabloem |
19f91ae to
ffe7c04
Compare
e164461 to
c37561b
Compare
12f6ee5 to
91d96a9
Compare
Codecov Report
@@ Coverage Diff @@
## master #15645 +/- ##
==========================================
+ Coverage 83.52% 83.80% +0.27%
==========================================
Files 445 444 -1
Lines 61415 60474 -941
==========================================
- Hits 51296 50679 -617
+ Misses 10119 9795 -324
Continue to review full report at Codecov.
|
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.
@pabloem FYI I don't think this is a blocker but the code for playground/backend/internal/api is not part of this PR. It's a simple enough test that I'm ok moving forward and trusting everything will come together in time.
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 breaking up this interface to follow more of the typical interface to method 1:1 carnality we see with go? Brainstorming out loud, what do we think about the following? The following isn't complete but just a conversation starter. I removed the bool from the return signatures as it could be part of the error.
import "io/fs"
type Setup interface {
Create() (fs.FS, error)
}
type Teardown interface {
Delete() error
}
type LifeCycle struct {
sdk pb.Sdk
root fs.FS
folderGlobs []string
}
func New(ctx context.Context, sdk pb.Sdk) (*LifeCycle, error) {
switch sdk {
case pb.Sdk_SDK_JAVA:
return &LifeCycle{
sdk: sdk,
root: javaFS, // See java_fs.go
folderGlobs: javaGlobs,
}, nil
default:
return nil, fmt.Errorf("%s isn't supported now", sdk)
}
}
func (lc *LifeCycle) Create() (fs.FS, error) {
for _, k := range lc.folderGlobs {
if err := MkdirAll( ... ); err != nil {
...
}
}
}
func (lc *LifeCycle) Delete() error {
....
}
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.
In addition to comments on the interface in playground/backend/internal/fs_tool/fs.go:
var (
javaGlobs = []string{
parentBaseFileFolder,
javaBaseFileFolder,
javaSrcFileFolder,
javaBinFileFolder,
}
javaFs = os.DirFS(parentBaseFileFolder)
)
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.
The comments above may remove the need for a specific JavaFileSystemService struct.
2fafb3f to
8462bdf
Compare
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.
This could be changed to:
folderGlobs []string
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.
Done.
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 imagine someone reading this in a web godoc would not know what folderGlobs is because it would be hidden.
// DeleteFolders deletes all previously provisioned folders
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.
Done.
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.
// CreateExecutableFile creates an executable file (i.e. file.java for the Java SDK).
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.
Done.
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.
Could we use os.WriteFile instead of ioutil.WriteFile? Please see https://golang.org/doc/go1.16#ioutil.
Also, may we hoist 0600 to the top of the file as a constant?
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.
Done.
damondouglas
left a comment
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.
One more change and this is ready. Thank you for all this work. May we add the go.sum to this PR via go mod tidy?
damondouglas
left a comment
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.
@pabloem LGTM
d6e9239 to
ad33048
Compare
|
sorry - there's a merge conflict here - can you resolve so I'll merge? : ) |
63f24b0 to
8060c74
Compare
Add LifeCycle; Add Java SDK environment of LifeCycle; Fix test description into README;
8060c74 to
fb6d554
Compare
Add FileSystemService and Java implementation of this service
This service contains methods to:
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
ValidatesRunnercompliance status (on master branch)Examples testing status on various runners
Post-Commit SDK/Transform Integration Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.