From 52b6a8ed746a6ece21372da5879f58db0bb8d707 Mon Sep 17 00:00:00 2001 From: ETPDEV Date: Sat, 26 Apr 2025 15:31:20 -0500 Subject: [PATCH] build: regenerate gRPC stubs with protobuf-5; add shim imports --- {grpc_gen => cam/grpc}/scheduler_pb2.py | 0 cam/grpc/scheduler_pb2_grpc.py | 183 +++++++++++++++++ pytest.ini | 23 +-- requirements.txt | 3 +- {grpc_gen => src/grpc_gen}/__init__.py | 0 src/grpc_gen/scheduler_pb2.py | 50 +++++ .../grpc_gen}/scheduler_pb2_grpc.py | 0 src/pytest.ini | 4 + src/scheduler_pb2.py | 52 +---- src/scheduler_pb2_grpc.py | 185 +----------------- src/src/grpc/__init__.py | 1 + src/src/grpc/scheduler_pb2.py | 50 +++++ src/src/grpc/scheduler_pb2_grpc.py | 183 +++++++++++++++++ 13 files changed, 479 insertions(+), 255 deletions(-) rename {grpc_gen => cam/grpc}/scheduler_pb2.py (100%) create mode 100644 cam/grpc/scheduler_pb2_grpc.py rename {grpc_gen => src/grpc_gen}/__init__.py (100%) create mode 100644 src/grpc_gen/scheduler_pb2.py rename {grpc_gen => src/grpc_gen}/scheduler_pb2_grpc.py (100%) create mode 100644 src/pytest.ini create mode 100644 src/src/grpc/__init__.py create mode 100644 src/src/grpc/scheduler_pb2.py create mode 100644 src/src/grpc/scheduler_pb2_grpc.py diff --git a/grpc_gen/scheduler_pb2.py b/cam/grpc/scheduler_pb2.py similarity index 100% rename from grpc_gen/scheduler_pb2.py rename to cam/grpc/scheduler_pb2.py diff --git a/cam/grpc/scheduler_pb2_grpc.py b/cam/grpc/scheduler_pb2_grpc.py new file mode 100644 index 0000000..e795aa7 --- /dev/null +++ b/cam/grpc/scheduler_pb2_grpc.py @@ -0,0 +1,183 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +import scheduler_pb2 as scheduler__pb2 + +GRPC_GENERATED_VERSION = '1.71.0' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + f' but the generated code in scheduler_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class SchedulerStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Enqueue = channel.unary_unary( + '/cam.Scheduler/Enqueue', + request_serializer=scheduler__pb2.EnqueueRequest.SerializeToString, + response_deserializer=scheduler__pb2.EnqueueReply.FromString, + _registered_method=True) + self.Dequeue = channel.unary_unary( + '/cam.Scheduler/Dequeue', + request_serializer=scheduler__pb2.DequeueRequest.SerializeToString, + response_deserializer=scheduler__pb2.DequeueReply.FromString, + _registered_method=True) + self.Reprioritise = channel.unary_unary( + '/cam.Scheduler/Reprioritise', + request_serializer=scheduler__pb2.ReprioritiseRequest.SerializeToString, + response_deserializer=scheduler__pb2.ReprioritiseReply.FromString, + _registered_method=True) + + +class SchedulerServicer(object): + """Missing associated documentation comment in .proto file.""" + + def Enqueue(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Dequeue(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Reprioritise(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SchedulerServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Enqueue': grpc.unary_unary_rpc_method_handler( + servicer.Enqueue, + request_deserializer=scheduler__pb2.EnqueueRequest.FromString, + response_serializer=scheduler__pb2.EnqueueReply.SerializeToString, + ), + 'Dequeue': grpc.unary_unary_rpc_method_handler( + servicer.Dequeue, + request_deserializer=scheduler__pb2.DequeueRequest.FromString, + response_serializer=scheduler__pb2.DequeueReply.SerializeToString, + ), + 'Reprioritise': grpc.unary_unary_rpc_method_handler( + servicer.Reprioritise, + request_deserializer=scheduler__pb2.ReprioritiseRequest.FromString, + response_serializer=scheduler__pb2.ReprioritiseReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'cam.Scheduler', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('cam.Scheduler', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class Scheduler(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def Enqueue(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, + '/cam.Scheduler/Enqueue', + scheduler__pb2.EnqueueRequest.SerializeToString, + scheduler__pb2.EnqueueReply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Dequeue(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, + '/cam.Scheduler/Dequeue', + scheduler__pb2.DequeueRequest.SerializeToString, + scheduler__pb2.DequeueReply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Reprioritise(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, + '/cam.Scheduler/Reprioritise', + scheduler__pb2.ReprioritiseRequest.SerializeToString, + scheduler__pb2.ReprioritiseReply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/pytest.ini b/pytest.ini index 561fb50..284da0b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,21 +1,4 @@ [pytest] -# -vv: verbose test names -# -s : show print/logs live -# --disable-warnings: skip warning noise -addopts = -vv -s --disable-warnings - -# live CLI logging of INFO+ with timestamps -log_cli = true -log_cli_level = INFO -log_cli_format = %(asctime)s %(levelname).1s %(message)s -log_cli_date_format = %H:%M:%S - -# capture DEBUG+ to a file for post‑mortem -logger_cli = true -logger_cli_level = INFO -logger_file = server.log -logger_file_level = DEBUG -logger_file_format = %(asctime)s %(levelname).1s %(name)s:%(lineno)d %(message)s - -markers = - timeout: mark test to fail if it runs longer than given time +pythonpath = + src + . diff --git a/requirements.txt b/requirements.txt index bdf11e3..358a2de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,10 +32,9 @@ packaging==25.0 pluggy==1.5.0 prometheus_client==0.21.1 propcache==0.3.1 -protobuf==6.30.2 +protobuf<6.0dev pycparser==2.22 pydantic==2.11.3 -pydantic_core==2.34.1 PyGithub==2.6.1 PyJWT==2.10.1 PyNaCl==1.5.0 diff --git a/grpc_gen/__init__.py b/src/grpc_gen/__init__.py similarity index 100% rename from grpc_gen/__init__.py rename to src/grpc_gen/__init__.py diff --git a/src/grpc_gen/scheduler_pb2.py b/src/grpc_gen/scheduler_pb2.py new file mode 100644 index 0000000..59362c6 --- /dev/null +++ b/src/grpc_gen/scheduler_pb2.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: scheduler.proto +# Protobuf Python Version: 5.29.0 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 29, + 0, + '', + 'scheduler.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fscheduler.proto\x12\x03\x63\x61m\"4\n\x03Job\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08priority\x18\x02 \x01(\x05\x12\x0f\n\x07payload\x18\x03 \x01(\t\"\'\n\x0e\x45nqueueRequest\x12\x15\n\x03job\x18\x01 \x01(\x0b\x32\x08.cam.Job\"\x0e\n\x0c\x45nqueueReply\"\x10\n\x0e\x44\x65queueRequest\"%\n\x0c\x44\x65queueReply\x12\x15\n\x03job\x18\x01 \x01(\x0b\x32\x08.cam.Job\"6\n\x13ReprioritiseRequest\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bnewPriority\x18\x02 \x01(\x05\"\x13\n\x11ReprioritiseReply2\xb3\x01\n\tScheduler\x12\x31\n\x07\x45nqueue\x12\x13.cam.EnqueueRequest\x1a\x11.cam.EnqueueReply\x12\x31\n\x07\x44\x65queue\x12\x13.cam.DequeueRequest\x1a\x11.cam.DequeueReply\x12@\n\x0cReprioritise\x12\x18.cam.ReprioritiseRequest\x1a\x16.cam.ReprioritiseReplyb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'scheduler_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_JOB']._serialized_start=24 + _globals['_JOB']._serialized_end=76 + _globals['_ENQUEUEREQUEST']._serialized_start=78 + _globals['_ENQUEUEREQUEST']._serialized_end=117 + _globals['_ENQUEUEREPLY']._serialized_start=119 + _globals['_ENQUEUEREPLY']._serialized_end=133 + _globals['_DEQUEUEREQUEST']._serialized_start=135 + _globals['_DEQUEUEREQUEST']._serialized_end=151 + _globals['_DEQUEUEREPLY']._serialized_start=153 + _globals['_DEQUEUEREPLY']._serialized_end=190 + _globals['_REPRIORITISEREQUEST']._serialized_start=192 + _globals['_REPRIORITISEREQUEST']._serialized_end=246 + _globals['_REPRIORITISEREPLY']._serialized_start=248 + _globals['_REPRIORITISEREPLY']._serialized_end=267 + _globals['_SCHEDULER']._serialized_start=270 + _globals['_SCHEDULER']._serialized_end=449 +# @@protoc_insertion_point(module_scope) diff --git a/grpc_gen/scheduler_pb2_grpc.py b/src/grpc_gen/scheduler_pb2_grpc.py similarity index 100% rename from grpc_gen/scheduler_pb2_grpc.py rename to src/grpc_gen/scheduler_pb2_grpc.py diff --git a/src/pytest.ini b/src/pytest.ini new file mode 100644 index 0000000..284da0b --- /dev/null +++ b/src/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +pythonpath = + src + . diff --git a/src/scheduler_pb2.py b/src/scheduler_pb2.py index 59362c6..f36be3e 100644 --- a/src/scheduler_pb2.py +++ b/src/scheduler_pb2.py @@ -1,50 +1,2 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# NO CHECKED-IN PROTOBUF GENCODE -# source: scheduler.proto -# Protobuf Python Version: 5.29.0 -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import runtime_version as _runtime_version -from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -_runtime_version.ValidateProtobufRuntimeVersion( - _runtime_version.Domain.PUBLIC, - 5, - 29, - 0, - '', - 'scheduler.proto' -) -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fscheduler.proto\x12\x03\x63\x61m\"4\n\x03Job\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08priority\x18\x02 \x01(\x05\x12\x0f\n\x07payload\x18\x03 \x01(\t\"\'\n\x0e\x45nqueueRequest\x12\x15\n\x03job\x18\x01 \x01(\x0b\x32\x08.cam.Job\"\x0e\n\x0c\x45nqueueReply\"\x10\n\x0e\x44\x65queueRequest\"%\n\x0c\x44\x65queueReply\x12\x15\n\x03job\x18\x01 \x01(\x0b\x32\x08.cam.Job\"6\n\x13ReprioritiseRequest\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bnewPriority\x18\x02 \x01(\x05\"\x13\n\x11ReprioritiseReply2\xb3\x01\n\tScheduler\x12\x31\n\x07\x45nqueue\x12\x13.cam.EnqueueRequest\x1a\x11.cam.EnqueueReply\x12\x31\n\x07\x44\x65queue\x12\x13.cam.DequeueRequest\x1a\x11.cam.DequeueReply\x12@\n\x0cReprioritise\x12\x18.cam.ReprioritiseRequest\x1a\x16.cam.ReprioritiseReplyb\x06proto3') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'scheduler_pb2', _globals) -if not _descriptor._USE_C_DESCRIPTORS: - DESCRIPTOR._loaded_options = None - _globals['_JOB']._serialized_start=24 - _globals['_JOB']._serialized_end=76 - _globals['_ENQUEUEREQUEST']._serialized_start=78 - _globals['_ENQUEUEREQUEST']._serialized_end=117 - _globals['_ENQUEUEREPLY']._serialized_start=119 - _globals['_ENQUEUEREPLY']._serialized_end=133 - _globals['_DEQUEUEREQUEST']._serialized_start=135 - _globals['_DEQUEUEREQUEST']._serialized_end=151 - _globals['_DEQUEUEREPLY']._serialized_start=153 - _globals['_DEQUEUEREPLY']._serialized_end=190 - _globals['_REPRIORITISEREQUEST']._serialized_start=192 - _globals['_REPRIORITISEREQUEST']._serialized_end=246 - _globals['_REPRIORITISEREPLY']._serialized_start=248 - _globals['_REPRIORITISEREPLY']._serialized_end=267 - _globals['_SCHEDULER']._serialized_start=270 - _globals['_SCHEDULER']._serialized_end=449 -# @@protoc_insertion_point(module_scope) +# shim: keep old import paths working +from cam.grpc.scheduler_pb2 import * # noqa: F401,F403 diff --git a/src/scheduler_pb2_grpc.py b/src/scheduler_pb2_grpc.py index e795aa7..d1d6ec1 100644 --- a/src/scheduler_pb2_grpc.py +++ b/src/scheduler_pb2_grpc.py @@ -1,183 +1,2 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc -import warnings - -import scheduler_pb2 as scheduler__pb2 - -GRPC_GENERATED_VERSION = '1.71.0' -GRPC_VERSION = grpc.__version__ -_version_not_supported = False - -try: - from grpc._utilities import first_version_is_lower - _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) -except ImportError: - _version_not_supported = True - -if _version_not_supported: - raise RuntimeError( - f'The grpc package installed is at version {GRPC_VERSION},' - + f' but the generated code in scheduler_pb2_grpc.py depends on' - + f' grpcio>={GRPC_GENERATED_VERSION}.' - + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' - + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' - ) - - -class SchedulerStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Enqueue = channel.unary_unary( - '/cam.Scheduler/Enqueue', - request_serializer=scheduler__pb2.EnqueueRequest.SerializeToString, - response_deserializer=scheduler__pb2.EnqueueReply.FromString, - _registered_method=True) - self.Dequeue = channel.unary_unary( - '/cam.Scheduler/Dequeue', - request_serializer=scheduler__pb2.DequeueRequest.SerializeToString, - response_deserializer=scheduler__pb2.DequeueReply.FromString, - _registered_method=True) - self.Reprioritise = channel.unary_unary( - '/cam.Scheduler/Reprioritise', - request_serializer=scheduler__pb2.ReprioritiseRequest.SerializeToString, - response_deserializer=scheduler__pb2.ReprioritiseReply.FromString, - _registered_method=True) - - -class SchedulerServicer(object): - """Missing associated documentation comment in .proto file.""" - - def Enqueue(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Dequeue(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Reprioritise(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_SchedulerServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Enqueue': grpc.unary_unary_rpc_method_handler( - servicer.Enqueue, - request_deserializer=scheduler__pb2.EnqueueRequest.FromString, - response_serializer=scheduler__pb2.EnqueueReply.SerializeToString, - ), - 'Dequeue': grpc.unary_unary_rpc_method_handler( - servicer.Dequeue, - request_deserializer=scheduler__pb2.DequeueRequest.FromString, - response_serializer=scheduler__pb2.DequeueReply.SerializeToString, - ), - 'Reprioritise': grpc.unary_unary_rpc_method_handler( - servicer.Reprioritise, - request_deserializer=scheduler__pb2.ReprioritiseRequest.FromString, - response_serializer=scheduler__pb2.ReprioritiseReply.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'cam.Scheduler', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - server.add_registered_method_handlers('cam.Scheduler', rpc_method_handlers) - - - # This class is part of an EXPERIMENTAL API. -class Scheduler(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def Enqueue(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, - '/cam.Scheduler/Enqueue', - scheduler__pb2.EnqueueRequest.SerializeToString, - scheduler__pb2.EnqueueReply.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def Dequeue(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, - '/cam.Scheduler/Dequeue', - scheduler__pb2.DequeueRequest.SerializeToString, - scheduler__pb2.DequeueReply.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) - - @staticmethod - def Reprioritise(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, - '/cam.Scheduler/Reprioritise', - scheduler__pb2.ReprioritiseRequest.SerializeToString, - scheduler__pb2.ReprioritiseReply.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - _registered_method=True) +# shim: keep old import paths working +from cam.grpc.scheduler_pb2_grpc import * # noqa: F401,F403 diff --git a/src/src/grpc/__init__.py b/src/src/grpc/__init__.py new file mode 100644 index 0000000..b0f504e --- /dev/null +++ b/src/src/grpc/__init__.py @@ -0,0 +1 @@ +# gRPC package marker diff --git a/src/src/grpc/scheduler_pb2.py b/src/src/grpc/scheduler_pb2.py new file mode 100644 index 0000000..59362c6 --- /dev/null +++ b/src/src/grpc/scheduler_pb2.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: scheduler.proto +# Protobuf Python Version: 5.29.0 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 29, + 0, + '', + 'scheduler.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fscheduler.proto\x12\x03\x63\x61m\"4\n\x03Job\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08priority\x18\x02 \x01(\x05\x12\x0f\n\x07payload\x18\x03 \x01(\t\"\'\n\x0e\x45nqueueRequest\x12\x15\n\x03job\x18\x01 \x01(\x0b\x32\x08.cam.Job\"\x0e\n\x0c\x45nqueueReply\"\x10\n\x0e\x44\x65queueRequest\"%\n\x0c\x44\x65queueReply\x12\x15\n\x03job\x18\x01 \x01(\x0b\x32\x08.cam.Job\"6\n\x13ReprioritiseRequest\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bnewPriority\x18\x02 \x01(\x05\"\x13\n\x11ReprioritiseReply2\xb3\x01\n\tScheduler\x12\x31\n\x07\x45nqueue\x12\x13.cam.EnqueueRequest\x1a\x11.cam.EnqueueReply\x12\x31\n\x07\x44\x65queue\x12\x13.cam.DequeueRequest\x1a\x11.cam.DequeueReply\x12@\n\x0cReprioritise\x12\x18.cam.ReprioritiseRequest\x1a\x16.cam.ReprioritiseReplyb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'scheduler_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + DESCRIPTOR._loaded_options = None + _globals['_JOB']._serialized_start=24 + _globals['_JOB']._serialized_end=76 + _globals['_ENQUEUEREQUEST']._serialized_start=78 + _globals['_ENQUEUEREQUEST']._serialized_end=117 + _globals['_ENQUEUEREPLY']._serialized_start=119 + _globals['_ENQUEUEREPLY']._serialized_end=133 + _globals['_DEQUEUEREQUEST']._serialized_start=135 + _globals['_DEQUEUEREQUEST']._serialized_end=151 + _globals['_DEQUEUEREPLY']._serialized_start=153 + _globals['_DEQUEUEREPLY']._serialized_end=190 + _globals['_REPRIORITISEREQUEST']._serialized_start=192 + _globals['_REPRIORITISEREQUEST']._serialized_end=246 + _globals['_REPRIORITISEREPLY']._serialized_start=248 + _globals['_REPRIORITISEREPLY']._serialized_end=267 + _globals['_SCHEDULER']._serialized_start=270 + _globals['_SCHEDULER']._serialized_end=449 +# @@protoc_insertion_point(module_scope) diff --git a/src/src/grpc/scheduler_pb2_grpc.py b/src/src/grpc/scheduler_pb2_grpc.py new file mode 100644 index 0000000..003dd2d --- /dev/null +++ b/src/src/grpc/scheduler_pb2_grpc.py @@ -0,0 +1,183 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +from . import scheduler_pb2 as scheduler__pb2 + +GRPC_GENERATED_VERSION = '1.71.0' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + f' but the generated code in scheduler_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class SchedulerStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Enqueue = channel.unary_unary( + '/cam.Scheduler/Enqueue', + request_serializer=scheduler__pb2.EnqueueRequest.SerializeToString, + response_deserializer=scheduler__pb2.EnqueueReply.FromString, + _registered_method=True) + self.Dequeue = channel.unary_unary( + '/cam.Scheduler/Dequeue', + request_serializer=scheduler__pb2.DequeueRequest.SerializeToString, + response_deserializer=scheduler__pb2.DequeueReply.FromString, + _registered_method=True) + self.Reprioritise = channel.unary_unary( + '/cam.Scheduler/Reprioritise', + request_serializer=scheduler__pb2.ReprioritiseRequest.SerializeToString, + response_deserializer=scheduler__pb2.ReprioritiseReply.FromString, + _registered_method=True) + + +class SchedulerServicer(object): + """Missing associated documentation comment in .proto file.""" + + def Enqueue(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Dequeue(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Reprioritise(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SchedulerServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Enqueue': grpc.unary_unary_rpc_method_handler( + servicer.Enqueue, + request_deserializer=scheduler__pb2.EnqueueRequest.FromString, + response_serializer=scheduler__pb2.EnqueueReply.SerializeToString, + ), + 'Dequeue': grpc.unary_unary_rpc_method_handler( + servicer.Dequeue, + request_deserializer=scheduler__pb2.DequeueRequest.FromString, + response_serializer=scheduler__pb2.DequeueReply.SerializeToString, + ), + 'Reprioritise': grpc.unary_unary_rpc_method_handler( + servicer.Reprioritise, + request_deserializer=scheduler__pb2.ReprioritiseRequest.FromString, + response_serializer=scheduler__pb2.ReprioritiseReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'cam.Scheduler', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('cam.Scheduler', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class Scheduler(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def Enqueue(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, + '/cam.Scheduler/Enqueue', + scheduler__pb2.EnqueueRequest.SerializeToString, + scheduler__pb2.EnqueueReply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Dequeue(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, + '/cam.Scheduler/Dequeue', + scheduler__pb2.DequeueRequest.SerializeToString, + scheduler__pb2.DequeueReply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Reprioritise(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, + '/cam.Scheduler/Reprioritise', + scheduler__pb2.ReprioritiseRequest.SerializeToString, + scheduler__pb2.ReprioritiseReply.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True)