Skip to content

Commit

Permalink
Merge pull request apache#15614 from [BEAM-12953] [Playground] Create…
Browse files Browse the repository at this point in the history
… protobuf file for front-back communication

* Add protofile

* Fix typos.

* add proto/grpc as dependencies

* Change protobuf file

* Renamed some fields and inserted SDK_UNSPECIFIED status

* Refactoring proto file

* Change int32 pipeline_id to string pipeline_uuid

* Edit comments for some messages.

Co-authored-by: gravicapa <dasha.m91@gmail.com>
Co-authored-by: Ilya Kozyrev <ilya.kozyrev@akvelon.com>
Co-authored-by: Pavel Avilov <avilovpavel6@gmail.com>
  • Loading branch information
4 people authored and dmitriikuzinepam committed Nov 2, 2021
1 parent b756117 commit f4062f8
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 1 deletion.
7 changes: 6 additions & 1 deletion playground/backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@

module beam.apache.org/playground/backend

go 1.16
go 1.16

require (
google.golang.org/grpc v1.41.0
google.golang.org/protobuf v1.27.1
)
95 changes: 95 additions & 0 deletions playground/playground/v1/playground.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

syntax = "proto3";

option go_package = "github.com/apache/beam/playground/v1;playground";
package playground.v1;

enum Sdk {
SDK_UNSPECIFIED = 0;
SDK_JAVA = 1;
SDK_GO = 2;
SDK_PYTHON = 3;
SDK_SCIO = 4;
}

enum Status {
STATUS_UNSPECIFIED = 0;
STATUS_EXECUTING = 1;
STATUS_FINISHED = 2;
STATUS_ERROR = 3;
}

// RunCodeRequest represents a code text and options of SDK which executes the code.
message RunCodeRequest {
string code = 1;
Sdk sdk = 2;
}

// RunCodeResponse contains information of the pipeline uuid.
message RunCodeResponse {
string pipeline_uuid = 1;
}

// CheckStatusRequest contains information of the pipeline uuid.
message CheckStatusRequest {
string pipeline_uuid = 1;
}

// StatusInfo contains information about the status of the code execution.
message CheckStatusResponse {
Status status = 1;
}

// GetCompileOutputRequest contains information of the pipeline uuid.
message GetCompileOutputRequest {
string pipeline_uuid = 1;
}

// GetCompileOutputResponse represents the result of the compiled code.
message GetCompileOutputResponse {
string output = 1;
Status compilation_status = 2;
}

// GetRunOutputRequest contains information of the pipeline uuid.
message GetRunOutputRequest {
string pipeline_uuid = 1;
}

// RunOutputResponse represents the result of the executed code.
message GetRunOutputResponse {
string output = 1;
Status compilation_status = 2;
}

service PlaygroundService {

// Submit the job for an execution and get the pipeline uuid.
rpc RunCode(RunCodeRequest) returns (RunCodeResponse);

// Get the status of pipeline execution.
rpc CheckStatus(CheckStatusRequest) returns (CheckStatusResponse);

// Get the result of pipeline execution.
rpc GetRunOutput(GetRunOutputRequest) returns (GetRunOutputResponse);

// Get the result of pipeline compilation.
rpc GetCompileOutput(GetCompileOutputRequest) returns (GetCompileOutputResponse);
}

0 comments on commit f4062f8

Please sign in to comment.