-
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
[BEAM-13633] [Playground] Implement method to get a default example for each SDKs #16484
Changes from 4 commits
509b7ff
e9cbe79
68edd97
ab16bea
d181cce
5743386
38673a4
4071bdb
3047469
d6e5d0b
f80ebdd
e035006
c3c5c79
931b79e
29e6f61
5688841
43fc19b
27b0157
b9b77b9
2187918
3655716
7fe3d8b
6830670
af655a5
b95103c
f4ae9a7
276ddd1
94a1613
1550e3a
8e6e1e5
af3623c
a7d6ded
3c8bd03
f273192
ebf5888
29c28b5
e413153
da6baa0
1ea1026
d8b7bdb
c189363
6e63cfb
0bcb1c4
66a3ca5
52622a3
4f54530
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,7 +262,7 @@ func (controller *playgroundController) GetPrecompiledObjects(ctx context.Contex | |
// GetPrecompiledObjectCode returns the code of the specific example | ||
func (controller *playgroundController) GetPrecompiledObjectCode(ctx context.Context, info *pb.GetPrecompiledObjectCodeRequest) (*pb.GetPrecompiledObjectCodeResponse, error) { | ||
cd := cloud_bucket.New() | ||
codeString, err := cd.GetPrecompiledObject(ctx, info.GetCloudPath()) | ||
codeString, err := cd.GetPrecompiledObjectCode(ctx, info.GetCloudPath()) | ||
if err != nil { | ||
logger.Errorf("GetPrecompiledObjectCode(): cloud storage error: %s", err.Error()) | ||
return nil, errors.InternalError("Error during getting Precompiled Object's code", "Error with cloud connection") | ||
|
@@ -294,3 +294,28 @@ func (controller *playgroundController) GetPrecompiledObjectLogs(ctx context.Con | |
response := pb.GetPrecompiledObjectLogsResponse{Output: logs} | ||
return &response, nil | ||
} | ||
|
||
// GetDefaultPrecompiledObject returns the default precompile object for sdk. | ||
func (controller *playgroundController) GetDefaultPrecompiledObject(ctx context.Context, info *pb.GetDefaultPrecompiledObjectRequest) (*pb.GetDefaultPrecompiledObjectResponse, error) { | ||
switch info.Sdk { | ||
case pb.Sdk_SDK_UNSPECIFIED, pb.Sdk_SDK_SCIO: | ||
logger.Errorf("GetDefaultPrecompiledObject(): unimplemented sdk: %s\n", info.Sdk) | ||
return nil, errors.InvalidArgumentError("Error during preparing", "Sdk is not implemented yet: %s", info.Sdk.String()) | ||
} | ||
|
||
bucket := cloud_bucket.New() | ||
precompiledObject, err := bucket.GetDefaultPrecompiledObject(ctx, controller.env.BeamSdkEnvs.DefaultExamplePath()) | ||
if err != nil { | ||
logger.Errorf("GetDefaultPrecompiledObject(): cloud storage error: %s", err.Error()) | ||
return nil, errors.InternalError("Error during getting default Precompiled Object", "Error with cloud connection") | ||
} | ||
|
||
response := pb.GetDefaultPrecompiledObjectResponse{PrecompiledObject: &pb.PrecompiledObject{ | ||
CloudPath: precompiledObject.CloudPath, | ||
Name: precompiledObject.Name, | ||
Description: precompiledObject.Description, | ||
Type: precompiledObject.Type, | ||
PipelineOptions: precompiledObject.PipelineOptions, | ||
}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we return the code of the example as well? Or it will be requested from the frontend after receiving this response? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this information will be enough for frontend. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please also add the |
||
return &response, nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ | |
"test_args": [ | ||
"test", | ||
"-v" | ||
] | ||
], | ||
"default_example": "SDK_GO/MinimalWordCount" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,6 @@ | |
"-cp", | ||
"bin:", | ||
"org.junit.runner.JUnitCore" | ||
] | ||
], | ||
"default_example": "SDK_JAVA/MinimalWordCount" | ||
} |
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 guess we can include SCIO as a supported 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.