diff --git a/ci/linux/gen_protocol.sh b/ci/linux/gen_protocol.sh index d6aece9..1beeb51 100755 --- a/ci/linux/gen_protocol.sh +++ b/ci/linux/gen_protocol.sh @@ -6,9 +6,7 @@ fi rm -Rf python/src/omotes_sdk_protocol/ mkdir -p python/src/omotes_sdk_protocol/ -protoc -I include/ -I src/ --python_out python/src/omotes_sdk_protocol/ ./src/job.proto -protoc -I include/ -I src/ --mypy_out python/src/omotes_sdk_protocol/ ./src/job.proto -protoc -I include/ -I src/ --python_out python/src/omotes_sdk_protocol/ ./src/workflow.proto -protoc -I include/ -I src/ --mypy_out python/src/omotes_sdk_protocol/ ./src/workflow.proto +protoc -I include/ -I src/ --python_out python/src/ --mypy_out python/src/ omotes_sdk_protocol/job.proto omotes_sdk_protocol/workflow.proto omotes_sdk_protocol/internal/task.proto +touch python/src/omotes_sdk_protocol/internal/__init__.py touch python/src/omotes_sdk_protocol/__init__.py touch python/src/omotes_sdk_protocol/py.typed diff --git a/python/src/omotes_sdk_protocol/internal/__init__.py b/python/src/omotes_sdk_protocol/internal/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python/src/omotes_sdk_protocol/internal/task_pb2.py b/python/src/omotes_sdk_protocol/internal/task_pb2.py new file mode 100644 index 0000000..8b04e39 --- /dev/null +++ b/python/src/omotes_sdk_protocol/internal/task_pb2.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: omotes_sdk_protocol/internal/task.proto +# Protobuf Python Version: 4.25.2 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from omotes_sdk_protocol import job_pb2 as omotes__sdk__protocol_dot_job__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'omotes_sdk_protocol/internal/task.proto\x1a\x1domotes_sdk_protocol/job.proto\"\x80\x02\n\nTaskResult\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\x16\n\x0e\x63\x65lery_task_id\x18\x02 \x01(\t\x12\x18\n\x10\x63\x65lery_task_type\x18\x06 \x01(\t\x12+\n\x0bresult_type\x18\x03 \x01(\x0e\x32\x16.TaskResult.ResultType\x12\x18\n\x0boutput_esdl\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x0c\n\x04logs\x18\x05 \x01(\t\x12#\n\resdl_messages\x18\x07 \x03(\x0b\x32\x0c.EsdlMessage\"&\n\nResultType\x12\r\n\tSUCCEEDED\x10\x00\x12\t\n\x05\x45RROR\x10\x01\x42\x0e\n\x0c_output_esdl\"\xdf\x01\n\x12TaskProgressUpdate\x12\x0e\n\x06job_id\x18\x01 \x01(\t\x12\x16\n\x0e\x63\x65lery_task_id\x18\x02 \x01(\t\x12\x18\n\x10\x63\x65lery_task_type\x18\x05 \x01(\t\x12\x34\n\x06status\x18\x06 \x01(\x0e\x32\".TaskProgressUpdate.ProgressStatusH\x00\x12\x12\n\x08progress\x18\x07 \x01(\x01H\x00\x12\x0f\n\x07message\x18\x04 \x01(\t\"\x1b\n\x0eProgressStatus\x12\t\n\x05START\x10\x00\x42\x0f\n\rprogress_typeb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'omotes_sdk_protocol.internal.task_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_TASKRESULT']._serialized_start=75 + _globals['_TASKRESULT']._serialized_end=331 + _globals['_TASKRESULT_RESULTTYPE']._serialized_start=277 + _globals['_TASKRESULT_RESULTTYPE']._serialized_end=315 + _globals['_TASKPROGRESSUPDATE']._serialized_start=334 + _globals['_TASKPROGRESSUPDATE']._serialized_end=557 + _globals['_TASKPROGRESSUPDATE_PROGRESSSTATUS']._serialized_start=513 + _globals['_TASKPROGRESSUPDATE_PROGRESSSTATUS']._serialized_end=540 +# @@protoc_insertion_point(module_scope) diff --git a/python/src/omotes_sdk_protocol/internal/task_pb2.pyi b/python/src/omotes_sdk_protocol/internal/task_pb2.pyi new file mode 100644 index 0000000..545ccbe --- /dev/null +++ b/python/src/omotes_sdk_protocol/internal/task_pb2.pyi @@ -0,0 +1,112 @@ +""" +@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" +import builtins +import collections.abc +import google.protobuf.descriptor +import google.protobuf.internal.containers +import google.protobuf.internal.enum_type_wrapper +import google.protobuf.message +import omotes_sdk_protocol.job_pb2 +import sys +import typing + +if sys.version_info >= (3, 10): + import typing as typing_extensions +else: + import typing_extensions + +DESCRIPTOR: google.protobuf.descriptor.FileDescriptor + +@typing_extensions.final +class TaskResult(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + class _ResultType: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _ResultTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[TaskResult._ResultType.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + SUCCEEDED: TaskResult._ResultType.ValueType # 0 + ERROR: TaskResult._ResultType.ValueType # 1 + + class ResultType(_ResultType, metaclass=_ResultTypeEnumTypeWrapper): ... + SUCCEEDED: TaskResult.ResultType.ValueType # 0 + ERROR: TaskResult.ResultType.ValueType # 1 + + JOB_ID_FIELD_NUMBER: builtins.int + CELERY_TASK_ID_FIELD_NUMBER: builtins.int + CELERY_TASK_TYPE_FIELD_NUMBER: builtins.int + RESULT_TYPE_FIELD_NUMBER: builtins.int + OUTPUT_ESDL_FIELD_NUMBER: builtins.int + LOGS_FIELD_NUMBER: builtins.int + ESDL_MESSAGES_FIELD_NUMBER: builtins.int + job_id: builtins.str + celery_task_id: builtins.str + celery_task_type: builtins.str + result_type: global___TaskResult.ResultType.ValueType + output_esdl: builtins.str + logs: builtins.str + @property + def esdl_messages(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[omotes_sdk_protocol.job_pb2.EsdlMessage]: ... + def __init__( + self, + *, + job_id: builtins.str = ..., + celery_task_id: builtins.str = ..., + celery_task_type: builtins.str = ..., + result_type: global___TaskResult.ResultType.ValueType = ..., + output_esdl: builtins.str | None = ..., + logs: builtins.str = ..., + esdl_messages: collections.abc.Iterable[omotes_sdk_protocol.job_pb2.EsdlMessage] | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["_output_esdl", b"_output_esdl", "output_esdl", b"output_esdl"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["_output_esdl", b"_output_esdl", "celery_task_id", b"celery_task_id", "celery_task_type", b"celery_task_type", "esdl_messages", b"esdl_messages", "job_id", b"job_id", "logs", b"logs", "output_esdl", b"output_esdl", "result_type", b"result_type"]) -> None: ... + def WhichOneof(self, oneof_group: typing_extensions.Literal["_output_esdl", b"_output_esdl"]) -> typing_extensions.Literal["output_esdl"] | None: ... + +global___TaskResult = TaskResult + +@typing_extensions.final +class TaskProgressUpdate(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + class _ProgressStatus: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _ProgressStatusEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[TaskProgressUpdate._ProgressStatus.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + START: TaskProgressUpdate._ProgressStatus.ValueType # 0 + + class ProgressStatus(_ProgressStatus, metaclass=_ProgressStatusEnumTypeWrapper): ... + START: TaskProgressUpdate.ProgressStatus.ValueType # 0 + + JOB_ID_FIELD_NUMBER: builtins.int + CELERY_TASK_ID_FIELD_NUMBER: builtins.int + CELERY_TASK_TYPE_FIELD_NUMBER: builtins.int + STATUS_FIELD_NUMBER: builtins.int + PROGRESS_FIELD_NUMBER: builtins.int + MESSAGE_FIELD_NUMBER: builtins.int + job_id: builtins.str + celery_task_id: builtins.str + celery_task_type: builtins.str + status: global___TaskProgressUpdate.ProgressStatus.ValueType + progress: builtins.float + message: builtins.str + def __init__( + self, + *, + job_id: builtins.str = ..., + celery_task_id: builtins.str = ..., + celery_task_type: builtins.str = ..., + status: global___TaskProgressUpdate.ProgressStatus.ValueType = ..., + progress: builtins.float = ..., + message: builtins.str = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["progress", b"progress", "progress_type", b"progress_type", "status", b"status"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["celery_task_id", b"celery_task_id", "celery_task_type", b"celery_task_type", "job_id", b"job_id", "message", b"message", "progress", b"progress", "progress_type", b"progress_type", "status", b"status"]) -> None: ... + def WhichOneof(self, oneof_group: typing_extensions.Literal["progress_type", b"progress_type"]) -> typing_extensions.Literal["status", "progress"] | None: ... + +global___TaskProgressUpdate = TaskProgressUpdate diff --git a/python/src/omotes_sdk_protocol/job_pb2.py b/python/src/omotes_sdk_protocol/job_pb2.py index 103c681..e66a5ba 100644 --- a/python/src/omotes_sdk_protocol/job_pb2.py +++ b/python/src/omotes_sdk_protocol/job_pb2.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: job.proto +# source: omotes_sdk_protocol/job.proto +# Protobuf Python Version: 4.25.2 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -15,67 +15,29 @@ from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\tjob.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xc6\x01\n\rJobSubmission\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x17\n\ntimeout_ms\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x15\n\rworkflow_type\x18\x03 \x01(\t\x12\x0c\n\x04\x65sdl\x18\x04 \x01(\t\x12,\n\x0bparams_dict\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1a\n\rjob_reference\x18\x06 \x01(\tH\x01\x88\x01\x01\x42\r\n\x0b_timeout_msB\x10\n\x0e_job_reference\"\xc1\x01\n\tJobResult\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12*\n\x0bresult_type\x18\x02 \x01(\x0e\x32\x15.JobResult.ResultType\x12\x18\n\x0boutput_esdl\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x0c\n\x04logs\x18\x04 \x01(\t\"B\n\nResultType\x12\r\n\tSUCCEEDED\x10\x00\x12\x0b\n\x07TIMEOUT\x10\x01\x12\t\n\x05\x45RROR\x10\x02\x12\r\n\tCANCELLED\x10\x03\x42\x0e\n\x0c_output_esdl\"D\n\x11JobProgressUpdate\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x10\n\x08progress\x18\x02 \x01(\x01\x12\x0f\n\x07message\x18\x03 \x01(\t\"\xa0\x01\n\x0fJobStatusUpdate\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12*\n\x06status\x18\x02 \x01(\x0e\x32\x1a.JobStatusUpdate.JobStatus\"S\n\tJobStatus\x12\x0e\n\nREGISTERED\x10\x00\x12\x0c\n\x08\x45NQUEUED\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x0c\n\x08\x46INISHED\x10\x03\x12\r\n\tCANCELLED\x10\x04\"\x19\n\tJobCancel\x12\x0c\n\x04uuid\x18\x01 \x01(\tb\x06proto3') - - - -_JOBSUBMISSION = DESCRIPTOR.message_types_by_name['JobSubmission'] -_JOBRESULT = DESCRIPTOR.message_types_by_name['JobResult'] -_JOBPROGRESSUPDATE = DESCRIPTOR.message_types_by_name['JobProgressUpdate'] -_JOBSTATUSUPDATE = DESCRIPTOR.message_types_by_name['JobStatusUpdate'] -_JOBCANCEL = DESCRIPTOR.message_types_by_name['JobCancel'] -_JOBRESULT_RESULTTYPE = _JOBRESULT.enum_types_by_name['ResultType'] -_JOBSTATUSUPDATE_JOBSTATUS = _JOBSTATUSUPDATE.enum_types_by_name['JobStatus'] -JobSubmission = _reflection.GeneratedProtocolMessageType('JobSubmission', (_message.Message,), { - 'DESCRIPTOR' : _JOBSUBMISSION, - '__module__' : 'job_pb2' - # @@protoc_insertion_point(class_scope:JobSubmission) - }) -_sym_db.RegisterMessage(JobSubmission) - -JobResult = _reflection.GeneratedProtocolMessageType('JobResult', (_message.Message,), { - 'DESCRIPTOR' : _JOBRESULT, - '__module__' : 'job_pb2' - # @@protoc_insertion_point(class_scope:JobResult) - }) -_sym_db.RegisterMessage(JobResult) - -JobProgressUpdate = _reflection.GeneratedProtocolMessageType('JobProgressUpdate', (_message.Message,), { - 'DESCRIPTOR' : _JOBPROGRESSUPDATE, - '__module__' : 'job_pb2' - # @@protoc_insertion_point(class_scope:JobProgressUpdate) - }) -_sym_db.RegisterMessage(JobProgressUpdate) - -JobStatusUpdate = _reflection.GeneratedProtocolMessageType('JobStatusUpdate', (_message.Message,), { - 'DESCRIPTOR' : _JOBSTATUSUPDATE, - '__module__' : 'job_pb2' - # @@protoc_insertion_point(class_scope:JobStatusUpdate) - }) -_sym_db.RegisterMessage(JobStatusUpdate) - -JobCancel = _reflection.GeneratedProtocolMessageType('JobCancel', (_message.Message,), { - 'DESCRIPTOR' : _JOBCANCEL, - '__module__' : 'job_pb2' - # @@protoc_insertion_point(class_scope:JobCancel) - }) -_sym_db.RegisterMessage(JobCancel) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1domotes_sdk_protocol/job.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xc6\x01\n\rJobSubmission\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x17\n\ntimeout_ms\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x15\n\rworkflow_type\x18\x03 \x01(\t\x12\x0c\n\x04\x65sdl\x18\x04 \x01(\t\x12,\n\x0bparams_dict\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1a\n\rjob_reference\x18\x06 \x01(\tH\x01\x88\x01\x01\x42\r\n\x0b_timeout_msB\x10\n\x0e_job_reference\"\xe6\x01\n\tJobResult\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12*\n\x0bresult_type\x18\x02 \x01(\x0e\x32\x15.JobResult.ResultType\x12\x18\n\x0boutput_esdl\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x0c\n\x04logs\x18\x04 \x01(\t\x12#\n\resdl_messages\x18\x05 \x03(\x0b\x32\x0c.EsdlMessage\"B\n\nResultType\x12\r\n\tSUCCEEDED\x10\x00\x12\x0b\n\x07TIMEOUT\x10\x01\x12\t\n\x05\x45RROR\x10\x02\x12\r\n\tCANCELLED\x10\x03\x42\x0e\n\x0c_output_esdl\"\xba\x01\n\x0b\x45sdlMessage\x12\x19\n\x11technical_message\x18\x01 \x01(\t\x12\'\n\x08severity\x18\x02 \x01(\x0e\x32\x15.EsdlMessage.Severity\x12\x1b\n\x0e\x65sdl_object_id\x18\x03 \x01(\tH\x00\x88\x01\x01\"7\n\x08Severity\x12\t\n\x05\x44\x45\x42UG\x10\x00\x12\x08\n\x04INFO\x10\x01\x12\x0b\n\x07WARNING\x10\x02\x12\t\n\x05\x45RROR\x10\x03\x42\x11\n\x0f_esdl_object_id\"D\n\x11JobProgressUpdate\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x10\n\x08progress\x18\x02 \x01(\x01\x12\x0f\n\x07message\x18\x03 \x01(\t\"\xa0\x01\n\x0fJobStatusUpdate\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12*\n\x06status\x18\x02 \x01(\x0e\x32\x1a.JobStatusUpdate.JobStatus\"S\n\tJobStatus\x12\x0e\n\nREGISTERED\x10\x00\x12\x0c\n\x08\x45NQUEUED\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\x0c\n\x08\x46INISHED\x10\x03\x12\r\n\tCANCELLED\x10\x04\"\x19\n\tJobCancel\x12\x0c\n\x04uuid\x18\x01 \x01(\tb\x06proto3') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'omotes_sdk_protocol.job_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR._options = None - _JOBSUBMISSION._serialized_start=44 - _JOBSUBMISSION._serialized_end=242 - _JOBRESULT._serialized_start=245 - _JOBRESULT._serialized_end=438 - _JOBRESULT_RESULTTYPE._serialized_start=356 - _JOBRESULT_RESULTTYPE._serialized_end=422 - _JOBPROGRESSUPDATE._serialized_start=440 - _JOBPROGRESSUPDATE._serialized_end=508 - _JOBSTATUSUPDATE._serialized_start=511 - _JOBSTATUSUPDATE._serialized_end=671 - _JOBSTATUSUPDATE_JOBSTATUS._serialized_start=588 - _JOBSTATUSUPDATE_JOBSTATUS._serialized_end=671 - _JOBCANCEL._serialized_start=673 - _JOBCANCEL._serialized_end=698 + _globals['_JOBSUBMISSION']._serialized_start=64 + _globals['_JOBSUBMISSION']._serialized_end=262 + _globals['_JOBRESULT']._serialized_start=265 + _globals['_JOBRESULT']._serialized_end=495 + _globals['_JOBRESULT_RESULTTYPE']._serialized_start=413 + _globals['_JOBRESULT_RESULTTYPE']._serialized_end=479 + _globals['_ESDLMESSAGE']._serialized_start=498 + _globals['_ESDLMESSAGE']._serialized_end=684 + _globals['_ESDLMESSAGE_SEVERITY']._serialized_start=610 + _globals['_ESDLMESSAGE_SEVERITY']._serialized_end=665 + _globals['_JOBPROGRESSUPDATE']._serialized_start=686 + _globals['_JOBPROGRESSUPDATE']._serialized_end=754 + _globals['_JOBSTATUSUPDATE']._serialized_start=757 + _globals['_JOBSTATUSUPDATE']._serialized_end=917 + _globals['_JOBSTATUSUPDATE_JOBSTATUS']._serialized_start=834 + _globals['_JOBSTATUSUPDATE_JOBSTATUS']._serialized_end=917 + _globals['_JOBCANCEL']._serialized_start=919 + _globals['_JOBCANCEL']._serialized_end=944 # @@protoc_insertion_point(module_scope) diff --git a/python/src/omotes_sdk_protocol/job_pb2.pyi b/python/src/omotes_sdk_protocol/job_pb2.pyi index f683b9a..96e01bb 100644 --- a/python/src/omotes_sdk_protocol/job_pb2.pyi +++ b/python/src/omotes_sdk_protocol/job_pb2.pyi @@ -3,7 +3,9 @@ isort:skip_file """ import builtins +import collections.abc import google.protobuf.descriptor +import google.protobuf.internal.containers import google.protobuf.internal.enum_type_wrapper import google.protobuf.message import google.protobuf.struct_pb2 @@ -79,11 +81,14 @@ class JobResult(google.protobuf.message.Message): RESULT_TYPE_FIELD_NUMBER: builtins.int OUTPUT_ESDL_FIELD_NUMBER: builtins.int LOGS_FIELD_NUMBER: builtins.int + ESDL_MESSAGES_FIELD_NUMBER: builtins.int uuid: builtins.str result_type: global___JobResult.ResultType.ValueType output_esdl: builtins.str """Raw XML string""" logs: builtins.str + @property + def esdl_messages(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EsdlMessage]: ... def __init__( self, *, @@ -91,13 +96,55 @@ class JobResult(google.protobuf.message.Message): result_type: global___JobResult.ResultType.ValueType = ..., output_esdl: builtins.str | None = ..., logs: builtins.str = ..., + esdl_messages: collections.abc.Iterable[global___EsdlMessage] | None = ..., ) -> None: ... def HasField(self, field_name: typing_extensions.Literal["_output_esdl", b"_output_esdl", "output_esdl", b"output_esdl"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_output_esdl", b"_output_esdl", "logs", b"logs", "output_esdl", b"output_esdl", "result_type", b"result_type", "uuid", b"uuid"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["_output_esdl", b"_output_esdl", "esdl_messages", b"esdl_messages", "logs", b"logs", "output_esdl", b"output_esdl", "result_type", b"result_type", "uuid", b"uuid"]) -> None: ... def WhichOneof(self, oneof_group: typing_extensions.Literal["_output_esdl", b"_output_esdl"]) -> typing_extensions.Literal["output_esdl"] | None: ... global___JobResult = JobResult +@typing_extensions.final +class EsdlMessage(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + class _Severity: + ValueType = typing.NewType("ValueType", builtins.int) + V: typing_extensions.TypeAlias = ValueType + + class _SeverityEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[EsdlMessage._Severity.ValueType], builtins.type): + DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor + DEBUG: EsdlMessage._Severity.ValueType # 0 + INFO: EsdlMessage._Severity.ValueType # 1 + WARNING: EsdlMessage._Severity.ValueType # 2 + ERROR: EsdlMessage._Severity.ValueType # 3 + + class Severity(_Severity, metaclass=_SeverityEnumTypeWrapper): ... + DEBUG: EsdlMessage.Severity.ValueType # 0 + INFO: EsdlMessage.Severity.ValueType # 1 + WARNING: EsdlMessage.Severity.ValueType # 2 + ERROR: EsdlMessage.Severity.ValueType # 3 + + TECHNICAL_MESSAGE_FIELD_NUMBER: builtins.int + SEVERITY_FIELD_NUMBER: builtins.int + ESDL_OBJECT_ID_FIELD_NUMBER: builtins.int + technical_message: builtins.str + severity: global___EsdlMessage.Severity.ValueType + esdl_object_id: builtins.str + """can be omitted for general energy system messages""" + def __init__( + self, + *, + technical_message: builtins.str = ..., + severity: global___EsdlMessage.Severity.ValueType = ..., + esdl_object_id: builtins.str | None = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["_esdl_object_id", b"_esdl_object_id", "esdl_object_id", b"esdl_object_id"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["_esdl_object_id", b"_esdl_object_id", "esdl_object_id", b"esdl_object_id", "severity", b"severity", "technical_message", b"technical_message"]) -> None: ... + def WhichOneof(self, oneof_group: typing_extensions.Literal["_esdl_object_id", b"_esdl_object_id"]) -> typing_extensions.Literal["esdl_object_id"] | None: ... + +global___EsdlMessage = EsdlMessage + @typing_extensions.final class JobProgressUpdate(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor diff --git a/python/src/omotes_sdk_protocol/workflow_pb2.py b/python/src/omotes_sdk_protocol/workflow_pb2.py index c5292bc..268392f 100644 --- a/python/src/omotes_sdk_protocol/workflow_pb2.py +++ b/python/src/omotes_sdk_protocol/workflow_pb2.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: workflow.proto +# source: omotes_sdk_protocol/workflow.proto +# Protobuf Python Version: 4.25.2 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -14,121 +14,33 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eworkflow.proto\"4\n\nStringEnum\x12\x10\n\x08key_name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\"V\n\x0fStringParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\tH\x00\x88\x01\x01\x12!\n\x0c\x65num_options\x18\x02 \x03(\x0b\x32\x0b.StringEnumB\n\n\x08_default\"4\n\x10\x42ooleanParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\n\n\x08_default\"x\n\x10IntegerParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x14\n\x07minimum\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x14\n\x07maximum\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\n\n\x08_defaultB\n\n\x08_minimumB\n\n\x08_maximum\"v\n\x0e\x46loatParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x14\n\x07minimum\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x14\n\x07maximum\x18\x03 \x01(\x02H\x02\x88\x01\x01\x42\n\n\x08_defaultB\n\n\x08_minimumB\n\n\x08_maximum\"5\n\x11\x44\x61teTimeParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_default\"y\n\x11\x44urationParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x02 \x01(\x02H\x00\x88\x01\x01\x12\x14\n\x07minimum\x18\x03 \x01(\x02H\x01\x88\x01\x01\x12\x14\n\x07maximum\x18\x04 \x01(\x02H\x02\x88\x01\x01\x42\n\n\x08_defaultB\n\n\x08_minimumB\n\n\x08_maximum\"\x9d\x03\n\x11WorkflowParameter\x12\x10\n\x08key_name\x18\x01 \x01(\t\x12\x12\n\x05title\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tH\x02\x88\x01\x01\x12,\n\x10string_parameter\x18\x04 \x01(\x0b\x32\x10.StringParameterH\x00\x12.\n\x11\x62oolean_parameter\x18\x05 \x01(\x0b\x32\x11.BooleanParameterH\x00\x12.\n\x11integer_parameter\x18\x06 \x01(\x0b\x32\x11.IntegerParameterH\x00\x12*\n\x0f\x66loat_parameter\x18\x07 \x01(\x0b\x32\x0f.FloatParameterH\x00\x12\x30\n\x12\x64\x61tetime_parameter\x18\x08 \x01(\x0b\x32\x12.DateTimeParameterH\x00\x12\x30\n\x12\x64uration_parameter\x18\t \x01(\x0b\x32\x12.DurationParameterH\x00\x42\x10\n\x0eparameter_typeB\x08\n\x06_titleB\x0e\n\x0c_description\"_\n\x08Workflow\x12\x11\n\ttype_name\x18\x01 \x01(\t\x12\x18\n\x10type_description\x18\x02 \x01(\t\x12&\n\nparameters\x18\x03 \x03(\x0b\x32\x12.WorkflowParameter\"2\n\x12\x41vailableWorkflows\x12\x1c\n\tworkflows\x18\x01 \x03(\x0b\x32\t.Workflow\"\x1b\n\x19RequestAvailableWorkflowsb\x06proto3') - - - -_STRINGENUM = DESCRIPTOR.message_types_by_name['StringEnum'] -_STRINGPARAMETER = DESCRIPTOR.message_types_by_name['StringParameter'] -_BOOLEANPARAMETER = DESCRIPTOR.message_types_by_name['BooleanParameter'] -_INTEGERPARAMETER = DESCRIPTOR.message_types_by_name['IntegerParameter'] -_FLOATPARAMETER = DESCRIPTOR.message_types_by_name['FloatParameter'] -_DATETIMEPARAMETER = DESCRIPTOR.message_types_by_name['DateTimeParameter'] -_DURATIONPARAMETER = DESCRIPTOR.message_types_by_name['DurationParameter'] -_WORKFLOWPARAMETER = DESCRIPTOR.message_types_by_name['WorkflowParameter'] -_WORKFLOW = DESCRIPTOR.message_types_by_name['Workflow'] -_AVAILABLEWORKFLOWS = DESCRIPTOR.message_types_by_name['AvailableWorkflows'] -_REQUESTAVAILABLEWORKFLOWS = DESCRIPTOR.message_types_by_name['RequestAvailableWorkflows'] -StringEnum = _reflection.GeneratedProtocolMessageType('StringEnum', (_message.Message,), { - 'DESCRIPTOR' : _STRINGENUM, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:StringEnum) - }) -_sym_db.RegisterMessage(StringEnum) - -StringParameter = _reflection.GeneratedProtocolMessageType('StringParameter', (_message.Message,), { - 'DESCRIPTOR' : _STRINGPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:StringParameter) - }) -_sym_db.RegisterMessage(StringParameter) - -BooleanParameter = _reflection.GeneratedProtocolMessageType('BooleanParameter', (_message.Message,), { - 'DESCRIPTOR' : _BOOLEANPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:BooleanParameter) - }) -_sym_db.RegisterMessage(BooleanParameter) - -IntegerParameter = _reflection.GeneratedProtocolMessageType('IntegerParameter', (_message.Message,), { - 'DESCRIPTOR' : _INTEGERPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:IntegerParameter) - }) -_sym_db.RegisterMessage(IntegerParameter) - -FloatParameter = _reflection.GeneratedProtocolMessageType('FloatParameter', (_message.Message,), { - 'DESCRIPTOR' : _FLOATPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:FloatParameter) - }) -_sym_db.RegisterMessage(FloatParameter) - -DateTimeParameter = _reflection.GeneratedProtocolMessageType('DateTimeParameter', (_message.Message,), { - 'DESCRIPTOR' : _DATETIMEPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:DateTimeParameter) - }) -_sym_db.RegisterMessage(DateTimeParameter) - -DurationParameter = _reflection.GeneratedProtocolMessageType('DurationParameter', (_message.Message,), { - 'DESCRIPTOR' : _DURATIONPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:DurationParameter) - }) -_sym_db.RegisterMessage(DurationParameter) - -WorkflowParameter = _reflection.GeneratedProtocolMessageType('WorkflowParameter', (_message.Message,), { - 'DESCRIPTOR' : _WORKFLOWPARAMETER, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:WorkflowParameter) - }) -_sym_db.RegisterMessage(WorkflowParameter) - -Workflow = _reflection.GeneratedProtocolMessageType('Workflow', (_message.Message,), { - 'DESCRIPTOR' : _WORKFLOW, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:Workflow) - }) -_sym_db.RegisterMessage(Workflow) - -AvailableWorkflows = _reflection.GeneratedProtocolMessageType('AvailableWorkflows', (_message.Message,), { - 'DESCRIPTOR' : _AVAILABLEWORKFLOWS, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:AvailableWorkflows) - }) -_sym_db.RegisterMessage(AvailableWorkflows) - -RequestAvailableWorkflows = _reflection.GeneratedProtocolMessageType('RequestAvailableWorkflows', (_message.Message,), { - 'DESCRIPTOR' : _REQUESTAVAILABLEWORKFLOWS, - '__module__' : 'workflow_pb2' - # @@protoc_insertion_point(class_scope:RequestAvailableWorkflows) - }) -_sym_db.RegisterMessage(RequestAvailableWorkflows) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"omotes_sdk_protocol/workflow.proto\"4\n\nStringEnum\x12\x10\n\x08key_name\x18\x01 \x01(\t\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\"V\n\x0fStringParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\tH\x00\x88\x01\x01\x12!\n\x0c\x65num_options\x18\x02 \x03(\x0b\x32\x0b.StringEnumB\n\n\x08_default\"4\n\x10\x42ooleanParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\n\n\x08_default\"x\n\x10IntegerParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x14\n\x07minimum\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x14\n\x07maximum\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\n\n\x08_defaultB\n\n\x08_minimumB\n\n\x08_maximum\"v\n\x0e\x46loatParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x14\n\x07minimum\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x14\n\x07maximum\x18\x03 \x01(\x02H\x02\x88\x01\x01\x42\n\n\x08_defaultB\n\n\x08_minimumB\n\n\x08_maximum\"5\n\x11\x44\x61teTimeParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_default\"y\n\x11\x44urationParameter\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x02 \x01(\x02H\x00\x88\x01\x01\x12\x14\n\x07minimum\x18\x03 \x01(\x02H\x01\x88\x01\x01\x12\x14\n\x07maximum\x18\x04 \x01(\x02H\x02\x88\x01\x01\x42\n\n\x08_defaultB\n\n\x08_minimumB\n\n\x08_maximum\"\x9d\x03\n\x11WorkflowParameter\x12\x10\n\x08key_name\x18\x01 \x01(\t\x12\x12\n\x05title\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x64\x65scription\x18\x03 \x01(\tH\x02\x88\x01\x01\x12,\n\x10string_parameter\x18\x04 \x01(\x0b\x32\x10.StringParameterH\x00\x12.\n\x11\x62oolean_parameter\x18\x05 \x01(\x0b\x32\x11.BooleanParameterH\x00\x12.\n\x11integer_parameter\x18\x06 \x01(\x0b\x32\x11.IntegerParameterH\x00\x12*\n\x0f\x66loat_parameter\x18\x07 \x01(\x0b\x32\x0f.FloatParameterH\x00\x12\x30\n\x12\x64\x61tetime_parameter\x18\x08 \x01(\x0b\x32\x12.DateTimeParameterH\x00\x12\x30\n\x12\x64uration_parameter\x18\t \x01(\x0b\x32\x12.DurationParameterH\x00\x42\x10\n\x0eparameter_typeB\x08\n\x06_titleB\x0e\n\x0c_description\"_\n\x08Workflow\x12\x11\n\ttype_name\x18\x01 \x01(\t\x12\x18\n\x10type_description\x18\x02 \x01(\t\x12&\n\nparameters\x18\x03 \x03(\x0b\x32\x12.WorkflowParameter\"2\n\x12\x41vailableWorkflows\x12\x1c\n\tworkflows\x18\x01 \x03(\x0b\x32\t.Workflow\"\x1b\n\x19RequestAvailableWorkflowsb\x06proto3') +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'omotes_sdk_protocol.workflow_pb2', _globals) if _descriptor._USE_C_DESCRIPTORS == False: - DESCRIPTOR._options = None - _STRINGENUM._serialized_start=18 - _STRINGENUM._serialized_end=70 - _STRINGPARAMETER._serialized_start=72 - _STRINGPARAMETER._serialized_end=158 - _BOOLEANPARAMETER._serialized_start=160 - _BOOLEANPARAMETER._serialized_end=212 - _INTEGERPARAMETER._serialized_start=214 - _INTEGERPARAMETER._serialized_end=334 - _FLOATPARAMETER._serialized_start=336 - _FLOATPARAMETER._serialized_end=454 - _DATETIMEPARAMETER._serialized_start=456 - _DATETIMEPARAMETER._serialized_end=509 - _DURATIONPARAMETER._serialized_start=511 - _DURATIONPARAMETER._serialized_end=632 - _WORKFLOWPARAMETER._serialized_start=635 - _WORKFLOWPARAMETER._serialized_end=1048 - _WORKFLOW._serialized_start=1050 - _WORKFLOW._serialized_end=1145 - _AVAILABLEWORKFLOWS._serialized_start=1147 - _AVAILABLEWORKFLOWS._serialized_end=1197 - _REQUESTAVAILABLEWORKFLOWS._serialized_start=1199 - _REQUESTAVAILABLEWORKFLOWS._serialized_end=1226 + _globals['_STRINGENUM']._serialized_start=38 + _globals['_STRINGENUM']._serialized_end=90 + _globals['_STRINGPARAMETER']._serialized_start=92 + _globals['_STRINGPARAMETER']._serialized_end=178 + _globals['_BOOLEANPARAMETER']._serialized_start=180 + _globals['_BOOLEANPARAMETER']._serialized_end=232 + _globals['_INTEGERPARAMETER']._serialized_start=234 + _globals['_INTEGERPARAMETER']._serialized_end=354 + _globals['_FLOATPARAMETER']._serialized_start=356 + _globals['_FLOATPARAMETER']._serialized_end=474 + _globals['_DATETIMEPARAMETER']._serialized_start=476 + _globals['_DATETIMEPARAMETER']._serialized_end=529 + _globals['_DURATIONPARAMETER']._serialized_start=531 + _globals['_DURATIONPARAMETER']._serialized_end=652 + _globals['_WORKFLOWPARAMETER']._serialized_start=655 + _globals['_WORKFLOWPARAMETER']._serialized_end=1068 + _globals['_WORKFLOW']._serialized_start=1070 + _globals['_WORKFLOW']._serialized_end=1165 + _globals['_AVAILABLEWORKFLOWS']._serialized_start=1167 + _globals['_AVAILABLEWORKFLOWS']._serialized_end=1217 + _globals['_REQUESTAVAILABLEWORKFLOWS']._serialized_start=1219 + _globals['_REQUESTAVAILABLEWORKFLOWS']._serialized_end=1246 # @@protoc_insertion_point(module_scope) diff --git a/src/omotes_sdk_protocol/internal/task.proto b/src/omotes_sdk_protocol/internal/task.proto new file mode 100644 index 0000000..7144c99 --- /dev/null +++ b/src/omotes_sdk_protocol/internal/task.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; + +import "omotes_sdk_protocol/job.proto"; + +message TaskResult { + string job_id = 1; + string celery_task_id = 2; + string celery_task_type = 6; + ResultType result_type = 3; + optional string output_esdl = 4; + string logs = 5; + repeated EsdlMessage esdl_messages = 7; + + enum ResultType { + SUCCEEDED = 0; + ERROR = 1; + } +} + +message TaskProgressUpdate { + string job_id = 1; + string celery_task_id = 2; + string celery_task_type = 5; + oneof progress_type { + ProgressStatus status = 6; + double progress = 7; + } + string message = 4; + + enum ProgressStatus { + START = 0; + } +} diff --git a/src/job.proto b/src/omotes_sdk_protocol/job.proto similarity index 73% rename from src/job.proto rename to src/omotes_sdk_protocol/job.proto index 5601d72..2635c03 100644 --- a/src/job.proto +++ b/src/omotes_sdk_protocol/job.proto @@ -15,6 +15,7 @@ message JobResult { ResultType result_type = 2; optional string output_esdl = 3; // Raw XML string string logs = 4; + repeated EsdlMessage esdl_messages = 5; enum ResultType { SUCCEEDED = 0; @@ -24,6 +25,19 @@ message JobResult { } } +message EsdlMessage { + string technical_message = 1; + Severity severity = 2; + optional string esdl_object_id = 3; // can be omitted for general energy system messages + + enum Severity { + DEBUG = 0; + INFO = 1; + WARNING = 2; + ERROR = 3; + } +} + message JobProgressUpdate { string uuid = 1; double progress = 2; diff --git a/src/workflow.proto b/src/omotes_sdk_protocol/workflow.proto similarity index 100% rename from src/workflow.proto rename to src/omotes_sdk_protocol/workflow.proto diff --git a/typescript/proto.ts b/typescript/proto.ts index 2286ff6..9ba7e04 100644 --- a/typescript/proto.ts +++ b/typescript/proto.ts @@ -7,8 +7,9 @@ const options = [ `--js_out="import_style=commonjs,binary:./src"`, `--ts_out="./src"`, `--proto_path="../src"`, - `job.proto`, - `workflow.proto` + 'omotes_sdk_protocol/job.proto', + 'omotes_sdk_protocol/workflow.proto', + 'omotes_sdk_protocol/internal/task.proto' ]; const script = `protoc ${options.join(' ')}`;