Skip to content

[BEAM-12988] [Playground] Add FileSystem service - #15645

Merged
pabloem merged 1 commit into
apache:masterfrom
akvelon:BEAM-12988-add-file-system-service
Oct 18, 2021
Merged

[BEAM-12988] [Playground] Add FileSystem service#15645
pabloem merged 1 commit into
apache:masterfrom
akvelon:BEAM-12988-add-file-system-service

Conversation

@AydarZaynutdinov

@AydarZaynutdinovAydarZaynutdinov commented Oct 4, 2021

Copy link
Copy Markdown
Contributor

Add FileSystemService and Java implementation of this service
This service contains methods to:

  • prepare file structure for compelled and executable files
  • delete all created folders for compelled and executable files
  • create an executable file with code

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).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

ValidatesRunner compliance status (on master branch)

LangULRDataflowFlinkSamzaSparkTwister2
Go---Build StatusBuild StatusBuild StatusBuild Status---
JavaBuild StatusBuild Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python---Build Status
Build Status
Build Status
Build Status
Build Status
Build StatusBuild Status---
XLangBuild StatusBuild StatusBuild StatusBuild StatusBuild Status---

Examples testing status on various runners

LangULRDataflowFlinkSamzaSparkTwister2
Go---------------------
Java---Build Status
Build Status
Build Status
---------------
Python---------------------
XLang---------------------

Post-Commit SDK/Transform Integration Tests Status (on master branch)

GoJavaPython
Build StatusBuild StatusBuild Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

---JavaPythonGoWebsiteWhitespaceTypescript
Non-portableBuild Status
Build Status
Build Status
Build Status
Build Status
Build StatusBuild StatusBuild StatusBuild Status
Portable---Build StatusBuild Status---------

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

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

@AydarZaynutdinov

Copy link
Copy Markdown
ContributorAuthor

R: @pabloem

@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch 3 times, most recently from 19f91ae to ffe7c04CompareOctober 4, 2021 17:09
@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch 2 times, most recently from e164461 to c37561bCompareOctober 5, 2021 14:34
@AydarZaynutdinov

Copy link
Copy Markdown
ContributorAuthor

R: @damondouglas

@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch 2 times, most recently from 12f6ee5 to 91d96a9CompareOctober 5, 2021 18:58
@codecov

codecovBot commented Oct 5, 2021

Copy link
Copy Markdown

Codecov Report

Merging #15645 (12f6ee5) into master (573beba) will increase coverage by 0.27%.
The diff coverage is 84.48%.

❗ Current head 12f6ee5 differs from pull request most recent head fb6d554. Consider uploading reports for the commit fb6d554 to get more accurate results
Impacted file tree graph

@@ 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 
Impacted FilesCoverage Δ
sdks/python/apache_beam/dataframe/partitionings.py96.03% <ø> (ø)
sdks/python/apache_beam/dataframe/transforms.py95.18% <ø> (ø)
sdks/python/apache_beam/examples/avro_bitcoin.py0.00% <ø> (ø)
...thon/apache_beam/examples/complete/autocomplete.py62.85% <ø> (ø)
...n/apache_beam/examples/complete/game/game_stats.py45.74% <ø> (ø)
...e_beam/examples/complete/game/hourly_team_score.py59.49% <ø> (ø)
...apache_beam/examples/complete/game/leader_board.py52.63% <ø> (ø)
...n/apache_beam/examples/complete/game/user_score.py62.79% <ø> (ø)
...e_beam/examples/complete/top_wikipedia_sessions.py80.70% <ø> (ø)
...che_beam/examples/flink/flink_streaming_impulse.py0.00% <0.00%> (ø)
... and 162 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd0ac38...fb6d554. Read the comment docs.

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.

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

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.

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 {
....
}

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.

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)
)

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 comments above may remove the need for a specific JavaFileSystemService struct.

@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch from 2fafb3f to 8462bdfCompareOctober 6, 2021 12:42

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.

This could be changed to:

folderGlobs []string

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

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.

// CreateExecutableFile creates an executable file (i.e. file.java for the Java SDK).

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

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.

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?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

@damondouglasdamondouglas 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.

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?

@damondouglasdamondouglas 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.

@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch 4 times, most recently from d6e9239 to ad33048CompareOctober 11, 2021 10:04
@pabloem

Copy link
Copy Markdown
Member

sorry - there's a merge conflict here - can you resolve so I'll merge? : )

@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch 2 times, most recently from 63f24b0 to 8060c74CompareOctober 15, 2021 05:03
Add LifeCycle;
Add Java SDK environment of LifeCycle;
Fix test description into README;
@AydarZaynutdinov
AydarZaynutdinovforce-pushed the BEAM-12988-add-file-system-service branch from 8060c74 to fb6d554CompareOctober 15, 2021 05:25
@pabloem
pabloem merged commit bf91bd7 into apache:masterOct 18, 2021
@AydarZaynutdinov
AydarZaynutdinov deleted the BEAM-12988-add-file-system-service branch October 19, 2021 11:06
Sign up for freeto 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.

3 participants

@AydarZaynutdinov@pabloem@damondouglas