diff --git a/playground/infrastructure/api/api_pb2.py b/playground/infrastructure/api/api_pb2.py new file mode 100644 index 000000000000..9a59596f92a4 --- /dev/null +++ b/playground/infrastructure/api/api_pb2.py @@ -0,0 +1,1059 @@ +# 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. + +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: api.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='api.proto', + package='api.v1', + syntax='proto3', + serialized_options=b'Z6beam.apache.org/playground/backend/internal;playground', + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\tapi.proto\x12\x06\x61pi.v1\"8\n\x0eRunCodeRequest\x12\x0c\n\x04\x63ode\x18\x01 \x01(\t\x12\x18\n\x03sdk\x18\x02 \x01(\x0e\x32\x0b.api.v1.Sdk\"(\n\x0fRunCodeResponse\x12\x15\n\rpipeline_uuid\x18\x01 \x01(\t\"+\n\x12\x43heckStatusRequest\x12\x15\n\rpipeline_uuid\x18\x01 \x01(\t\"5\n\x13\x43heckStatusResponse\x12\x1e\n\x06status\x18\x01 \x01(\x0e\x32\x0e.api.v1.Status\"0\n\x17GetCompileOutputRequest\x12\x15\n\rpipeline_uuid\x18\x01 \x01(\t\"V\n\x18GetCompileOutputResponse\x12\x0e\n\x06output\x18\x01 \x01(\t\x12*\n\x12\x63ompilation_status\x18\x02 \x01(\x0e\x32\x0e.api.v1.Status\",\n\x13GetRunOutputRequest\x12\x15\n\rpipeline_uuid\x18\x01 \x01(\t\"&\n\x14GetRunOutputResponse\x12\x0e\n\x06output\x18\x01 \x01(\t\"+\n\x12GetRunErrorRequest\x12\x15\n\rpipeline_uuid\x18\x01 \x01(\t\"%\n\x13GetRunErrorResponse\x12\x0e\n\x06output\x18\x01 \x01(\t\"F\n\x18GetListOfExamplesRequest\x12\x18\n\x03sdk\x18\x01 \x01(\x0e\x32\x0b.api.v1.Sdk\x12\x10\n\x08\x63\x61tegory\x18\x02 \x01(\t\"e\n\x07\x45xample\x12\x14\n\x0c\x65xample_uuid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12!\n\x04type\x18\x04 \x01(\x0e\x32\x13.api.v1.ExampleType\"\x9d\x01\n\nCategories\x12\x18\n\x03sdk\x18\x01 \x01(\x0e\x32\x0b.api.v1.Sdk\x12/\n\ncategories\x18\x02 \x03(\x0b\x32\x1b.api.v1.Categories.Category\x1a\x44\n\x08\x43\x61tegory\x12\x15\n\rcategory_name\x18\x01 \x01(\t\x12!\n\x08\x65xamples\x18\x02 \x03(\x0b\x32\x0f.api.v1.Example\"E\n\x19GetListOfExamplesResponse\x12(\n\x0csdk_examples\x18\x01 \x03(\x0b\x32\x12.api.v1.Categories\")\n\x11GetExampleRequest\x12\x14\n\x0c\x65xample_uuid\x18\x01 \x01(\t\"\"\n\x12GetExampleResponse\x12\x0c\n\x04\x63ode\x18\x01 \x01(\t*R\n\x03Sdk\x12\x13\n\x0fSDK_UNSPECIFIED\x10\x00\x12\x0c\n\x08SDK_JAVA\x10\x01\x12\n\n\x06SDK_GO\x10\x02\x12\x0e\n\nSDK_PYTHON\x10\x03\x12\x0c\n\x08SDK_SCIO\x10\x04*\xa3\x02\n\x06Status\x12\x16\n\x12STATUS_UNSPECIFIED\x10\x00\x12\x15\n\x11STATUS_VALIDATING\x10\x01\x12\x1b\n\x17STATUS_VALIDATION_ERROR\x10\x02\x12\x14\n\x10STATUS_PREPARING\x10\x03\x12\x1c\n\x18STATUS_PREPARATION_ERROR\x10\x04\x12\x14\n\x10STATUS_COMPILING\x10\x05\x12\x18\n\x14STATUS_COMPILE_ERROR\x10\x06\x12\x14\n\x10STATUS_EXECUTING\x10\x07\x12\x13\n\x0fSTATUS_FINISHED\x10\x08\x12\x14\n\x10STATUS_RUN_ERROR\x10\t\x12\x10\n\x0cSTATUS_ERROR\x10\n\x12\x16\n\x12STATUS_RUN_TIMEOUT\x10\x0b*Z\n\x0b\x45xampleType\x12\x18\n\x14\x45XAMPLE_TYPE_DEFAULT\x10\x00\x12\x15\n\x11\x45XAMPLE_TYPE_KATA\x10\x01\x12\x1a\n\x16\x45XAMPLE_TYPE_UNIT_TEST\x10\x02\x32\xed\x04\n\x11PlaygroundService\x12:\n\x07RunCode\x12\x16.api.v1.RunCodeRequest\x1a\x17.api.v1.RunCodeResponse\x12\x46\n\x0b\x43heckStatus\x12\x1a.api.v1.CheckStatusRequest\x1a\x1b.api.v1.CheckStatusResponse\x12I\n\x0cGetRunOutput\x12\x1b.api.v1.GetRunOutputRequest\x1a\x1c.api.v1.GetRunOutputResponse\x12\x46\n\x0bGetRunError\x12\x1a.api.v1.GetRunErrorRequest\x1a\x1b.api.v1.GetRunErrorResponse\x12U\n\x10GetCompileOutput\x12\x1f.api.v1.GetCompileOutputRequest\x1a .api.v1.GetCompileOutputResponse\x12X\n\x11GetListOfExamples\x12 .api.v1.GetListOfExamplesRequest\x1a!.api.v1.GetListOfExamplesResponse\x12\x43\n\nGetExample\x12\x19.api.v1.GetExampleRequest\x1a\x1a.api.v1.GetExampleResponse\x12K\n\x10GetExampleOutput\x12\x19.api.v1.GetExampleRequest\x1a\x1c.api.v1.GetRunOutputResponseB8Z6beam.apache.org/playground/backend/internal;playgroundb\x06proto3' +) + +_SDK = _descriptor.EnumDescriptor( + name='Sdk', + full_name='api.v1.Sdk', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='SDK_UNSPECIFIED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SDK_JAVA', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SDK_GO', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SDK_PYTHON', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='SDK_SCIO', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1014, + serialized_end=1096, +) +_sym_db.RegisterEnumDescriptor(_SDK) + +Sdk = enum_type_wrapper.EnumTypeWrapper(_SDK) +_STATUS = _descriptor.EnumDescriptor( + name='Status', + full_name='api.v1.Status', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='STATUS_UNSPECIFIED', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_VALIDATING', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_VALIDATION_ERROR', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_PREPARING', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_PREPARATION_ERROR', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_COMPILING', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_COMPILE_ERROR', index=6, number=6, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_EXECUTING', index=7, number=7, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_FINISHED', index=8, number=8, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_RUN_ERROR', index=9, number=9, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_ERROR', index=10, number=10, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_RUN_TIMEOUT', index=11, number=11, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1099, + serialized_end=1390, +) +_sym_db.RegisterEnumDescriptor(_STATUS) + +Status = enum_type_wrapper.EnumTypeWrapper(_STATUS) +_EXAMPLETYPE = _descriptor.EnumDescriptor( + name='ExampleType', + full_name='api.v1.ExampleType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='EXAMPLE_TYPE_DEFAULT', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EXAMPLE_TYPE_KATA', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='EXAMPLE_TYPE_UNIT_TEST', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=1392, + serialized_end=1482, +) +_sym_db.RegisterEnumDescriptor(_EXAMPLETYPE) + +ExampleType = enum_type_wrapper.EnumTypeWrapper(_EXAMPLETYPE) +SDK_UNSPECIFIED = 0 +SDK_JAVA = 1 +SDK_GO = 2 +SDK_PYTHON = 3 +SDK_SCIO = 4 +STATUS_UNSPECIFIED = 0 +STATUS_VALIDATING = 1 +STATUS_VALIDATION_ERROR = 2 +STATUS_PREPARING = 3 +STATUS_PREPARATION_ERROR = 4 +STATUS_COMPILING = 5 +STATUS_COMPILE_ERROR = 6 +STATUS_EXECUTING = 7 +STATUS_FINISHED = 8 +STATUS_RUN_ERROR = 9 +STATUS_ERROR = 10 +STATUS_RUN_TIMEOUT = 11 +EXAMPLE_TYPE_DEFAULT = 0 +EXAMPLE_TYPE_KATA = 1 +EXAMPLE_TYPE_UNIT_TEST = 2 + + + +_RUNCODEREQUEST = _descriptor.Descriptor( + name='RunCodeRequest', + full_name='api.v1.RunCodeRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='code', full_name='api.v1.RunCodeRequest.code', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sdk', full_name='api.v1.RunCodeRequest.sdk', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=21, + serialized_end=77, +) + + +_RUNCODERESPONSE = _descriptor.Descriptor( + name='RunCodeResponse', + full_name='api.v1.RunCodeResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='pipeline_uuid', full_name='api.v1.RunCodeResponse.pipeline_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=79, + serialized_end=119, +) + + +_CHECKSTATUSREQUEST = _descriptor.Descriptor( + name='CheckStatusRequest', + full_name='api.v1.CheckStatusRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='pipeline_uuid', full_name='api.v1.CheckStatusRequest.pipeline_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=121, + serialized_end=164, +) + + +_CHECKSTATUSRESPONSE = _descriptor.Descriptor( + name='CheckStatusResponse', + full_name='api.v1.CheckStatusResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='status', full_name='api.v1.CheckStatusResponse.status', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=166, + serialized_end=219, +) + + +_GETCOMPILEOUTPUTREQUEST = _descriptor.Descriptor( + name='GetCompileOutputRequest', + full_name='api.v1.GetCompileOutputRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='pipeline_uuid', full_name='api.v1.GetCompileOutputRequest.pipeline_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=221, + serialized_end=269, +) + + +_GETCOMPILEOUTPUTRESPONSE = _descriptor.Descriptor( + name='GetCompileOutputResponse', + full_name='api.v1.GetCompileOutputResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='output', full_name='api.v1.GetCompileOutputResponse.output', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='compilation_status', full_name='api.v1.GetCompileOutputResponse.compilation_status', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=271, + serialized_end=357, +) + + +_GETRUNOUTPUTREQUEST = _descriptor.Descriptor( + name='GetRunOutputRequest', + full_name='api.v1.GetRunOutputRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='pipeline_uuid', full_name='api.v1.GetRunOutputRequest.pipeline_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=359, + serialized_end=403, +) + + +_GETRUNOUTPUTRESPONSE = _descriptor.Descriptor( + name='GetRunOutputResponse', + full_name='api.v1.GetRunOutputResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='output', full_name='api.v1.GetRunOutputResponse.output', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=405, + serialized_end=443, +) + + +_GETRUNERRORREQUEST = _descriptor.Descriptor( + name='GetRunErrorRequest', + full_name='api.v1.GetRunErrorRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='pipeline_uuid', full_name='api.v1.GetRunErrorRequest.pipeline_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=445, + serialized_end=488, +) + + +_GETRUNERRORRESPONSE = _descriptor.Descriptor( + name='GetRunErrorResponse', + full_name='api.v1.GetRunErrorResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='output', full_name='api.v1.GetRunErrorResponse.output', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=490, + serialized_end=527, +) + + +_GETLISTOFEXAMPLESREQUEST = _descriptor.Descriptor( + name='GetListOfExamplesRequest', + full_name='api.v1.GetListOfExamplesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='sdk', full_name='api.v1.GetListOfExamplesRequest.sdk', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='category', full_name='api.v1.GetListOfExamplesRequest.category', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=529, + serialized_end=599, +) + + +_EXAMPLE = _descriptor.Descriptor( + name='Example', + full_name='api.v1.Example', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='example_uuid', full_name='api.v1.Example.example_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='name', full_name='api.v1.Example.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='description', full_name='api.v1.Example.description', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='type', full_name='api.v1.Example.type', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=601, + serialized_end=702, +) + + +_CATEGORIES_CATEGORY = _descriptor.Descriptor( + name='Category', + full_name='api.v1.Categories.Category', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='category_name', full_name='api.v1.Categories.Category.category_name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='examples', full_name='api.v1.Categories.Category.examples', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=794, + serialized_end=862, +) + +_CATEGORIES = _descriptor.Descriptor( + name='Categories', + full_name='api.v1.Categories', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='sdk', full_name='api.v1.Categories.sdk', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='categories', full_name='api.v1.Categories.categories', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_CATEGORIES_CATEGORY, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=705, + serialized_end=862, +) + + +_GETLISTOFEXAMPLESRESPONSE = _descriptor.Descriptor( + name='GetListOfExamplesResponse', + full_name='api.v1.GetListOfExamplesResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='sdk_examples', full_name='api.v1.GetListOfExamplesResponse.sdk_examples', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=864, + serialized_end=933, +) + + +_GETEXAMPLEREQUEST = _descriptor.Descriptor( + name='GetExampleRequest', + full_name='api.v1.GetExampleRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='example_uuid', full_name='api.v1.GetExampleRequest.example_uuid', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=935, + serialized_end=976, +) + + +_GETEXAMPLERESPONSE = _descriptor.Descriptor( + name='GetExampleResponse', + full_name='api.v1.GetExampleResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='code', full_name='api.v1.GetExampleResponse.code', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=978, + serialized_end=1012, +) + +_RUNCODEREQUEST.fields_by_name['sdk'].enum_type = _SDK +_CHECKSTATUSRESPONSE.fields_by_name['status'].enum_type = _STATUS +_GETCOMPILEOUTPUTRESPONSE.fields_by_name['compilation_status'].enum_type = _STATUS +_GETLISTOFEXAMPLESREQUEST.fields_by_name['sdk'].enum_type = _SDK +_EXAMPLE.fields_by_name['type'].enum_type = _EXAMPLETYPE +_CATEGORIES_CATEGORY.fields_by_name['examples'].message_type = _EXAMPLE +_CATEGORIES_CATEGORY.containing_type = _CATEGORIES +_CATEGORIES.fields_by_name['sdk'].enum_type = _SDK +_CATEGORIES.fields_by_name['categories'].message_type = _CATEGORIES_CATEGORY +_GETLISTOFEXAMPLESRESPONSE.fields_by_name['sdk_examples'].message_type = _CATEGORIES +DESCRIPTOR.message_types_by_name['RunCodeRequest'] = _RUNCODEREQUEST +DESCRIPTOR.message_types_by_name['RunCodeResponse'] = _RUNCODERESPONSE +DESCRIPTOR.message_types_by_name['CheckStatusRequest'] = _CHECKSTATUSREQUEST +DESCRIPTOR.message_types_by_name['CheckStatusResponse'] = _CHECKSTATUSRESPONSE +DESCRIPTOR.message_types_by_name['GetCompileOutputRequest'] = _GETCOMPILEOUTPUTREQUEST +DESCRIPTOR.message_types_by_name['GetCompileOutputResponse'] = _GETCOMPILEOUTPUTRESPONSE +DESCRIPTOR.message_types_by_name['GetRunOutputRequest'] = _GETRUNOUTPUTREQUEST +DESCRIPTOR.message_types_by_name['GetRunOutputResponse'] = _GETRUNOUTPUTRESPONSE +DESCRIPTOR.message_types_by_name['GetRunErrorRequest'] = _GETRUNERRORREQUEST +DESCRIPTOR.message_types_by_name['GetRunErrorResponse'] = _GETRUNERRORRESPONSE +DESCRIPTOR.message_types_by_name['GetListOfExamplesRequest'] = _GETLISTOFEXAMPLESREQUEST +DESCRIPTOR.message_types_by_name['Example'] = _EXAMPLE +DESCRIPTOR.message_types_by_name['Categories'] = _CATEGORIES +DESCRIPTOR.message_types_by_name['GetListOfExamplesResponse'] = _GETLISTOFEXAMPLESRESPONSE +DESCRIPTOR.message_types_by_name['GetExampleRequest'] = _GETEXAMPLEREQUEST +DESCRIPTOR.message_types_by_name['GetExampleResponse'] = _GETEXAMPLERESPONSE +DESCRIPTOR.enum_types_by_name['Sdk'] = _SDK +DESCRIPTOR.enum_types_by_name['Status'] = _STATUS +DESCRIPTOR.enum_types_by_name['ExampleType'] = _EXAMPLETYPE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +RunCodeRequest = _reflection.GeneratedProtocolMessageType('RunCodeRequest', (_message.Message,), { + 'DESCRIPTOR' : _RUNCODEREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.RunCodeRequest) + }) +_sym_db.RegisterMessage(RunCodeRequest) + +RunCodeResponse = _reflection.GeneratedProtocolMessageType('RunCodeResponse', (_message.Message,), { + 'DESCRIPTOR' : _RUNCODERESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.RunCodeResponse) + }) +_sym_db.RegisterMessage(RunCodeResponse) + +CheckStatusRequest = _reflection.GeneratedProtocolMessageType('CheckStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _CHECKSTATUSREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.CheckStatusRequest) + }) +_sym_db.RegisterMessage(CheckStatusRequest) + +CheckStatusResponse = _reflection.GeneratedProtocolMessageType('CheckStatusResponse', (_message.Message,), { + 'DESCRIPTOR' : _CHECKSTATUSRESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.CheckStatusResponse) + }) +_sym_db.RegisterMessage(CheckStatusResponse) + +GetCompileOutputRequest = _reflection.GeneratedProtocolMessageType('GetCompileOutputRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETCOMPILEOUTPUTREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetCompileOutputRequest) + }) +_sym_db.RegisterMessage(GetCompileOutputRequest) + +GetCompileOutputResponse = _reflection.GeneratedProtocolMessageType('GetCompileOutputResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETCOMPILEOUTPUTRESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetCompileOutputResponse) + }) +_sym_db.RegisterMessage(GetCompileOutputResponse) + +GetRunOutputRequest = _reflection.GeneratedProtocolMessageType('GetRunOutputRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETRUNOUTPUTREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetRunOutputRequest) + }) +_sym_db.RegisterMessage(GetRunOutputRequest) + +GetRunOutputResponse = _reflection.GeneratedProtocolMessageType('GetRunOutputResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETRUNOUTPUTRESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetRunOutputResponse) + }) +_sym_db.RegisterMessage(GetRunOutputResponse) + +GetRunErrorRequest = _reflection.GeneratedProtocolMessageType('GetRunErrorRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETRUNERRORREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetRunErrorRequest) + }) +_sym_db.RegisterMessage(GetRunErrorRequest) + +GetRunErrorResponse = _reflection.GeneratedProtocolMessageType('GetRunErrorResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETRUNERRORRESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetRunErrorResponse) + }) +_sym_db.RegisterMessage(GetRunErrorResponse) + +GetListOfExamplesRequest = _reflection.GeneratedProtocolMessageType('GetListOfExamplesRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETLISTOFEXAMPLESREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetListOfExamplesRequest) + }) +_sym_db.RegisterMessage(GetListOfExamplesRequest) + +Example = _reflection.GeneratedProtocolMessageType('Example', (_message.Message,), { + 'DESCRIPTOR' : _EXAMPLE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.Example) + }) +_sym_db.RegisterMessage(Example) + +Categories = _reflection.GeneratedProtocolMessageType('Categories', (_message.Message,), { + + 'Category' : _reflection.GeneratedProtocolMessageType('Category', (_message.Message,), { + 'DESCRIPTOR' : _CATEGORIES_CATEGORY, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.Categories.Category) + }) + , + 'DESCRIPTOR' : _CATEGORIES, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.Categories) + }) +_sym_db.RegisterMessage(Categories) +_sym_db.RegisterMessage(Categories.Category) + +GetListOfExamplesResponse = _reflection.GeneratedProtocolMessageType('GetListOfExamplesResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETLISTOFEXAMPLESRESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetListOfExamplesResponse) + }) +_sym_db.RegisterMessage(GetListOfExamplesResponse) + +GetExampleRequest = _reflection.GeneratedProtocolMessageType('GetExampleRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETEXAMPLEREQUEST, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetExampleRequest) + }) +_sym_db.RegisterMessage(GetExampleRequest) + +GetExampleResponse = _reflection.GeneratedProtocolMessageType('GetExampleResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETEXAMPLERESPONSE, + '__module__' : 'api_pb2' + # @@protoc_insertion_point(class_scope:api.v1.GetExampleResponse) + }) +_sym_db.RegisterMessage(GetExampleResponse) + + +DESCRIPTOR._options = None + +_PLAYGROUNDSERVICE = _descriptor.ServiceDescriptor( + name='PlaygroundService', + full_name='api.v1.PlaygroundService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=1485, + serialized_end=2106, + methods=[ + _descriptor.MethodDescriptor( + name='RunCode', + full_name='api.v1.PlaygroundService.RunCode', + index=0, + containing_service=None, + input_type=_RUNCODEREQUEST, + output_type=_RUNCODERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='CheckStatus', + full_name='api.v1.PlaygroundService.CheckStatus', + index=1, + containing_service=None, + input_type=_CHECKSTATUSREQUEST, + output_type=_CHECKSTATUSRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetRunOutput', + full_name='api.v1.PlaygroundService.GetRunOutput', + index=2, + containing_service=None, + input_type=_GETRUNOUTPUTREQUEST, + output_type=_GETRUNOUTPUTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetRunError', + full_name='api.v1.PlaygroundService.GetRunError', + index=3, + containing_service=None, + input_type=_GETRUNERRORREQUEST, + output_type=_GETRUNERRORRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetCompileOutput', + full_name='api.v1.PlaygroundService.GetCompileOutput', + index=4, + containing_service=None, + input_type=_GETCOMPILEOUTPUTREQUEST, + output_type=_GETCOMPILEOUTPUTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetListOfExamples', + full_name='api.v1.PlaygroundService.GetListOfExamples', + index=5, + containing_service=None, + input_type=_GETLISTOFEXAMPLESREQUEST, + output_type=_GETLISTOFEXAMPLESRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetExample', + full_name='api.v1.PlaygroundService.GetExample', + index=6, + containing_service=None, + input_type=_GETEXAMPLEREQUEST, + output_type=_GETEXAMPLERESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='GetExampleOutput', + full_name='api.v1.PlaygroundService.GetExampleOutput', + index=7, + containing_service=None, + input_type=_GETEXAMPLEREQUEST, + output_type=_GETRUNOUTPUTRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_PLAYGROUNDSERVICE) + +DESCRIPTOR.services_by_name['PlaygroundService'] = _PLAYGROUNDSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/playground/infrastructure/api/api_pb2_grpc.py b/playground/infrastructure/api/api_pb2_grpc.py new file mode 100644 index 000000000000..0fbf5cfa9bcf --- /dev/null +++ b/playground/infrastructure/api/api_pb2_grpc.py @@ -0,0 +1,319 @@ +# 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. + +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +from . import api_pb2 as api__pb2 + + +class PlaygroundServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.RunCode = channel.unary_unary( + '/api.v1.PlaygroundService/RunCode', + request_serializer=api__pb2.RunCodeRequest.SerializeToString, + response_deserializer=api__pb2.RunCodeResponse.FromString, + ) + self.CheckStatus = channel.unary_unary( + '/api.v1.PlaygroundService/CheckStatus', + request_serializer=api__pb2.CheckStatusRequest.SerializeToString, + response_deserializer=api__pb2.CheckStatusResponse.FromString, + ) + self.GetRunOutput = channel.unary_unary( + '/api.v1.PlaygroundService/GetRunOutput', + request_serializer=api__pb2.GetRunOutputRequest.SerializeToString, + response_deserializer=api__pb2.GetRunOutputResponse.FromString, + ) + self.GetRunError = channel.unary_unary( + '/api.v1.PlaygroundService/GetRunError', + request_serializer=api__pb2.GetRunErrorRequest.SerializeToString, + response_deserializer=api__pb2.GetRunErrorResponse.FromString, + ) + self.GetCompileOutput = channel.unary_unary( + '/api.v1.PlaygroundService/GetCompileOutput', + request_serializer=api__pb2.GetCompileOutputRequest.SerializeToString, + response_deserializer=api__pb2.GetCompileOutputResponse.FromString, + ) + self.GetListOfExamples = channel.unary_unary( + '/api.v1.PlaygroundService/GetListOfExamples', + request_serializer=api__pb2.GetListOfExamplesRequest.SerializeToString, + response_deserializer=api__pb2.GetListOfExamplesResponse.FromString, + ) + self.GetExample = channel.unary_unary( + '/api.v1.PlaygroundService/GetExample', + request_serializer=api__pb2.GetExampleRequest.SerializeToString, + response_deserializer=api__pb2.GetExampleResponse.FromString, + ) + self.GetExampleOutput = channel.unary_unary( + '/api.v1.PlaygroundService/GetExampleOutput', + request_serializer=api__pb2.GetExampleRequest.SerializeToString, + response_deserializer=api__pb2.GetRunOutputResponse.FromString, + ) + + +class PlaygroundServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def RunCode(self, request, context): + """Submit the job for an execution and get the pipeline uuid. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CheckStatus(self, request, context): + """Get the status of pipeline execution. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetRunOutput(self, request, context): + """Get the result of pipeline execution. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetRunError(self, request, context): + """Get the error of pipeline execution. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetCompileOutput(self, request, context): + """Get the result of pipeline compilation. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetListOfExamples(self, request, context): + """Get the list of precompiled examples. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetExample(self, request, context): + """Get the code of an example. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetExampleOutput(self, request, context): + """Get the precompiled details of an example. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_PlaygroundServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'RunCode': grpc.unary_unary_rpc_method_handler( + servicer.RunCode, + request_deserializer=api__pb2.RunCodeRequest.FromString, + response_serializer=api__pb2.RunCodeResponse.SerializeToString, + ), + 'CheckStatus': grpc.unary_unary_rpc_method_handler( + servicer.CheckStatus, + request_deserializer=api__pb2.CheckStatusRequest.FromString, + response_serializer=api__pb2.CheckStatusResponse.SerializeToString, + ), + 'GetRunOutput': grpc.unary_unary_rpc_method_handler( + servicer.GetRunOutput, + request_deserializer=api__pb2.GetRunOutputRequest.FromString, + response_serializer=api__pb2.GetRunOutputResponse.SerializeToString, + ), + 'GetRunError': grpc.unary_unary_rpc_method_handler( + servicer.GetRunError, + request_deserializer=api__pb2.GetRunErrorRequest.FromString, + response_serializer=api__pb2.GetRunErrorResponse.SerializeToString, + ), + 'GetCompileOutput': grpc.unary_unary_rpc_method_handler( + servicer.GetCompileOutput, + request_deserializer=api__pb2.GetCompileOutputRequest.FromString, + response_serializer=api__pb2.GetCompileOutputResponse.SerializeToString, + ), + 'GetListOfExamples': grpc.unary_unary_rpc_method_handler( + servicer.GetListOfExamples, + request_deserializer=api__pb2.GetListOfExamplesRequest.FromString, + response_serializer=api__pb2.GetListOfExamplesResponse.SerializeToString, + ), + 'GetExample': grpc.unary_unary_rpc_method_handler( + servicer.GetExample, + request_deserializer=api__pb2.GetExampleRequest.FromString, + response_serializer=api__pb2.GetExampleResponse.SerializeToString, + ), + 'GetExampleOutput': grpc.unary_unary_rpc_method_handler( + servicer.GetExampleOutput, + request_deserializer=api__pb2.GetExampleRequest.FromString, + response_serializer=api__pb2.GetRunOutputResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'api.v1.PlaygroundService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class PlaygroundService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def RunCode(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/RunCode', + api__pb2.RunCodeRequest.SerializeToString, + api__pb2.RunCodeResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def CheckStatus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/CheckStatus', + api__pb2.CheckStatusRequest.SerializeToString, + api__pb2.CheckStatusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetRunOutput(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/GetRunOutput', + api__pb2.GetRunOutputRequest.SerializeToString, + api__pb2.GetRunOutputResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetRunError(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/GetRunError', + api__pb2.GetRunErrorRequest.SerializeToString, + api__pb2.GetRunErrorResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetCompileOutput(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/GetCompileOutput', + api__pb2.GetCompileOutputRequest.SerializeToString, + api__pb2.GetCompileOutputResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetListOfExamples(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/GetListOfExamples', + api__pb2.GetListOfExamplesRequest.SerializeToString, + api__pb2.GetListOfExamplesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetExample(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/GetExample', + api__pb2.GetExampleRequest.SerializeToString, + api__pb2.GetExampleResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetExampleOutput(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/api.v1.PlaygroundService/GetExampleOutput', + api__pb2.GetExampleRequest.SerializeToString, + api__pb2.GetRunOutputResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/playground/infrastructure/config.py b/playground/infrastructure/config.py new file mode 100644 index 000000000000..21da2d010fa3 --- /dev/null +++ b/playground/infrastructure/config.py @@ -0,0 +1,22 @@ +# 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. + +import os +from dataclasses import dataclass + + +@dataclass(frozen=True) +class Config: + SERVER_ADDRESS = os.getenv("SERVER_ADDRESS", "localhost:8080") diff --git a/playground/infrastructure/grpc_client.py b/playground/infrastructure/grpc_client.py new file mode 100644 index 000000000000..9e4e0dc74968 --- /dev/null +++ b/playground/infrastructure/grpc_client.py @@ -0,0 +1,122 @@ +# 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. +import uuid + +import grpc + +from infrastructure.api import api_pb2_grpc, api_pb2 +from infrastructure.config import Config + + +class GRPCClient: + """GRPCClient is gRPC client for sending a request to the backend.""" + + def __init__(self): + self._channel = grpc.aio.insecure_channel(Config.SERVER_ADDRESS) + self._stub = api_pb2_grpc.PlaygroundServiceStub(self._channel) + + async def run_code(self, code: str, sdk: api_pb2.Sdk) -> str: + """ + Run example by his code and SDK + + Args: + code: code of the example. + sdk: SDK of the example. + + Returns: + pipeline_uuid: uuid of the pipeline + """ + if sdk not in api_pb2.Sdk.values(): + sdks = api_pb2.Sdk.keys() + sdks.remove(api_pb2.Sdk.Name(0)) # del SDK_UNSPECIFIED + raise Exception(f'Incorrect sdk: must be from this pool: {", ".join(sdks)}') + request = api_pb2.RunCodeRequest(code=code, sdk=sdk) + response = await self._stub.RunCode(request) + return response.pipeline_uuid + + async def check_status(self, pipeline_uuid: str) -> api_pb2.Status: + """ + Get status of the pipeline by his pipeline + + Args: + pipeline_uuid: uuid of the pipeline + + Returns: + status: status of the pipeline + """ + self._verify_pipeline_uuid(pipeline_uuid) + request = api_pb2.CheckStatusRequest(pipeline_uuid=pipeline_uuid) + response = await self._stub.CheckStatus(request) + return response.status + + async def get_run_error(self, pipeline_uuid: str) -> str: + """ + Get the error of pipeline execution. + + Args: + pipeline_uuid: uuid of the pipeline + + Returns: + output: contain an error of pipeline execution + """ + self._verify_pipeline_uuid(pipeline_uuid) + request = api_pb2.GetRunErrorRequest(pipeline_uuid=pipeline_uuid) + response = await self._stub.GetRunError(request) + return response.output + + async def get_run_output(self, pipeline_uuid: str) -> str: + """ + Get the result of pipeline execution. + + Args: + pipeline_uuid: uuid of the pipeline + + Returns: + output: contain the result of pipeline execution + """ + self._verify_pipeline_uuid(pipeline_uuid) + request = api_pb2.GetRunOutputRequest(pipeline_uuid=pipeline_uuid) + response = await self._stub.GetRunOutput(request) + return response.output + + async def get_compile_output(self, pipeline_uuid: str) -> str: + """ + Get the result of pipeline compilation. + + Args: + pipeline_uuid: uuid of the pipeline + + Returns: + output: contain the result of pipeline compilation + """ + self._verify_pipeline_uuid(pipeline_uuid) + request = api_pb2.GetCompileOutputRequest(pipeline_uuid=pipeline_uuid) + response = await self._stub.GetCompileOutput(request) + return response.output + + def _verify_pipeline_uuid(self, pipeline_uuid): + """ + Verify the received pipeline_uuid format + + Args: + pipeline_uuid: uuid of the pipeline + + Returns: + If pipeline ID is not verified, will raise an exception + """ + try: + uuid.UUID(pipeline_uuid) + except ValueError: + raise Exception(f"Incorrect pipeline uuid: '{pipeline_uuid}'") diff --git a/playground/infrastructure/test_grpc_client.py b/playground/infrastructure/test_grpc_client.py new file mode 100644 index 000000000000..627733149441 --- /dev/null +++ b/playground/infrastructure/test_grpc_client.py @@ -0,0 +1,81 @@ +# 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. + +import uuid +from unittest.mock import AsyncMock +import pytest + +from infrastructure.api import api_pb2 +from infrastructure.grpc_client import GRPCClient + + +@pytest.fixture() +def mock_run_code(mocker): + async_mock = AsyncMock(return_value=str(uuid.uuid4())) + mocker.patch('infrastructure.grpc_client.GRPCClient.run_code', side_effect=async_mock) + return async_mock + + +@pytest.fixture() +def mock_check_status(mocker): + async_mock = AsyncMock(return_value=api_pb2.STATUS_FINISHED) + mocker.patch('infrastructure.grpc_client.GRPCClient.check_status', side_effect=async_mock) + return async_mock + + +@pytest.fixture() +def mock_get_run_error(mocker): + async_mock = AsyncMock(return_value="MOCK_ERROR") + mocker.patch('infrastructure.grpc_client.GRPCClient.get_run_error', side_effect=async_mock) + return async_mock + + +@pytest.fixture() +def mock_get_run_output(mocker): + async_mock = AsyncMock(return_value="MOCK_RUN_OUTPUT") + mocker.patch('infrastructure.grpc_client.GRPCClient.get_run_output', side_effect=async_mock) + return async_mock + + +@pytest.fixture() +def mock_get_compile_output(mocker): + async_mock = AsyncMock(return_value="MOCK_COMPILE_OUTPUT") + mocker.patch('infrastructure.grpc_client.GRPCClient.get_compile_output', side_effect=async_mock) + return async_mock + + +class TestGRPCClient: + + @pytest.mark.asyncio + async def test_run_code(self, mock_run_code): + result = await GRPCClient().run_code("", api_pb2.SDK_GO) + assert isinstance(result, str) + + @pytest.mark.asyncio + async def test_check_status(self, mock_check_status): + result = await GRPCClient().check_status(str(uuid.uuid4())) + assert result == api_pb2.STATUS_FINISHED + + async def test_get_run_error(self, mock_get_run_error): + result = await GRPCClient().get_run_error(str(uuid.uuid4())) + assert result == "MOCK_ERROR" + + async def test_get_run_output(self, mock_get_run_output): + result = await GRPCClient().get_run_output(str(uuid.uuid4())) + assert result == "MOCK_RUN_OUTPUT" + + async def test_get_compile_output(self, mock_get_compile_output): + result = await GRPCClient().get_compile_output(str(uuid.uuid4())) + assert result == "MOCK_COMPILE_OUTPUT"