Skip to content

Commit

Permalink
add work flow protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkTNO committed Jun 18, 2024
1 parent 3afa7e9 commit 8351c5e
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ci/linux/create_venv.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env sh

python3 -m venv ./.venv
python3.11 -m venv ./.venv
. .venv/bin/activate
pip3 install pip-tools
2 changes: 2 additions & 0 deletions ci/linux/gen_protocol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ 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/work_flow.proto
protoc -I include/ -I src/ --mypy_out python/src/omotes_sdk_protocol/ ./src/work_flow.proto
touch python/src/omotes_sdk_protocol/__init__.py
touch python/src/omotes_sdk_protocol/py.typed
19 changes: 2 additions & 17 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=dev --output-file=dev-requirements.txt pyproject.toml
# pip-compile --constraint=requirements.txt --extra=dev --output-file=dev-requirements.txt pyproject.toml
#
build==1.0.3
# via
# omotes_sdk_protocol_generation (pyproject.toml)
# pip-tools
click==8.1.7
# via pip-tools
colorama==0.4.6
# via
# build
# click
importlib-metadata==7.0.1
# via build
mypy-protobuf==3.5.0
# via omotes_sdk_protocol_generation (pyproject.toml)
packaging==23.2
Expand All @@ -30,19 +24,10 @@ pyproject-hooks==1.0.0
# via build
setuptools-git-versioning==1.13.5
# via omotes_sdk_protocol_generation (pyproject.toml)
toml==0.10.2
# via setuptools-git-versioning
tomli==2.0.1
# via
# build
# pip-tools
# pyproject-hooks
types-protobuf==4.24.0.20240106
# via mypy-protobuf
wheel==0.42.0
# via pip-tools
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
34 changes: 34 additions & 0 deletions python/src/omotes_sdk_protocol/work_flow_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

102 changes: 102 additions & 0 deletions python/src/omotes_sdk_protocol/work_flow_pb2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
"""
@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 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 Parameter(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

class _ParameterType:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType

class _ParameterTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Parameter._ParameterType.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
STRING: Parameter._ParameterType.ValueType # 0
INTEGER: Parameter._ParameterType.ValueType # 1
DOUBLE: Parameter._ParameterType.ValueType # 2
DATETIME: Parameter._ParameterType.ValueType # 3

class ParameterType(_ParameterType, metaclass=_ParameterTypeEnumTypeWrapper): ...
STRING: Parameter.ParameterType.ValueType # 0
INTEGER: Parameter.ParameterType.ValueType # 1
DOUBLE: Parameter.ParameterType.ValueType # 2
DATETIME: Parameter.ParameterType.ValueType # 3

NAME_FIELD_NUMBER: builtins.int
PARAMETER_TYPE_FIELD_NUMBER: builtins.int
name: builtins.str
parameter_type: global___Parameter.ParameterType.ValueType
def __init__(
self,
*,
name: builtins.str = ...,
parameter_type: global___Parameter.ParameterType.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["name", b"name", "parameter_type", b"parameter_type"]) -> None: ...

global___Parameter = Parameter

@typing_extensions.final
class WorkFlow(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

TYPE_NAME_FIELD_NUMBER: builtins.int
TYPE_DESCRIPTION_FIELD_NUMBER: builtins.int
ADDITIONAL_PARAMETERS_FIELD_NUMBER: builtins.int
type_name: builtins.str
type_description: builtins.str
@property
def additional_parameters(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Parameter]: ...
def __init__(
self,
*,
type_name: builtins.str = ...,
type_description: builtins.str = ...,
additional_parameters: collections.abc.Iterable[global___Parameter] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["additional_parameters", b"additional_parameters", "type_description", b"type_description", "type_name", b"type_name"]) -> None: ...

global___WorkFlow = WorkFlow

@typing_extensions.final
class AvailableWorkFlows(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

WORK_FLOWS_FIELD_NUMBER: builtins.int
@property
def work_flows(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___WorkFlow]: ...
def __init__(
self,
*,
work_flows: collections.abc.Iterable[global___WorkFlow] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["work_flows", b"work_flows"]) -> None: ...

global___AvailableWorkFlows = AvailableWorkFlows

@typing_extensions.final
class RequestAvailableWorkflows(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

def __init__(
self,
) -> None: ...

global___RequestAvailableWorkflows = RequestAvailableWorkflows
25 changes: 25 additions & 0 deletions src/work_flow.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

message Parameter {
string name = 1;
ParameterType parameter_type = 2;

enum ParameterType {
STRING = 0;
INTEGER = 1;
DOUBLE = 2;
DATETIME = 3;
}
}

message WorkFlow {
string type_name = 1;
string type_description = 2;
repeated Parameter additional_parameters = 3;
}

message AvailableWorkFlows {
repeated WorkFlow work_flows = 1;
}

message RequestAvailableWorkflows {}

0 comments on commit 8351c5e

Please sign in to comment.