Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

31: Add parameter relations to protocol for workflows. #35

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions python/src/omotes_sdk_protocol/workflow_pb2.py

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

49 changes: 47 additions & 2 deletions python/src/omotes_sdk_protocol/workflow_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ 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, 8):
if sys.version_info >= (3, 10):
import typing as typing_extensions
else:
import typing_extensions
Expand Down Expand Up @@ -227,25 +228,69 @@ class WorkflowParameter(google.protobuf.message.Message):

global___WorkflowParameter = WorkflowParameter

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

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

class _RelationTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[ParameterRelation._RelationType.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
GREATER: ParameterRelation._RelationType.ValueType # 0
GREATER_OR_EQ: ParameterRelation._RelationType.ValueType # 1
SMALLER: ParameterRelation._RelationType.ValueType # 2
SMALLER_OR_EQ: ParameterRelation._RelationType.ValueType # 3
EQ: ParameterRelation._RelationType.ValueType # 4

class RelationType(_RelationType, metaclass=_RelationTypeEnumTypeWrapper): ...
GREATER: ParameterRelation.RelationType.ValueType # 0
GREATER_OR_EQ: ParameterRelation.RelationType.ValueType # 1
SMALLER: ParameterRelation.RelationType.ValueType # 2
SMALLER_OR_EQ: ParameterRelation.RelationType.ValueType # 3
EQ: ParameterRelation.RelationType.ValueType # 4

KEY_1_FIELD_NUMBER: builtins.int
KEY_2_FIELD_NUMBER: builtins.int
RELATION_FIELD_NUMBER: builtins.int
key_1: builtins.str
key_2: builtins.str
relation: global___ParameterRelation.RelationType.ValueType
def __init__(
self,
*,
key_1: builtins.str = ...,
key_2: builtins.str = ...,
relation: global___ParameterRelation.RelationType.ValueType = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["key_1", b"key_1", "key_2", b"key_2", "relation", b"relation"]) -> None: ...

global___ParameterRelation = ParameterRelation

@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
PARAMETERS_FIELD_NUMBER: builtins.int
RELATIONS_FIELD_NUMBER: builtins.int
type_name: builtins.str
type_description: builtins.str
@property
def parameters(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___WorkflowParameter]: ...
@property
def relations(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ParameterRelation]: ...
def __init__(
self,
*,
type_name: builtins.str = ...,
type_description: builtins.str = ...,
parameters: collections.abc.Iterable[global___WorkflowParameter] | None = ...,
relations: collections.abc.Iterable[global___ParameterRelation] | None = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["parameters", b"parameters", "type_description", b"type_description", "type_name", b"type_name"]) -> None: ...
def ClearField(self, field_name: typing_extensions.Literal["parameters", b"parameters", "relations", b"relations", "type_description", b"type_description", "type_name", b"type_name"]) -> None: ...

global___Workflow = Workflow

Expand Down
15 changes: 15 additions & 0 deletions src/omotes_sdk_protocol/workflow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,25 @@ message WorkflowParameter {
}
}

message ParameterRelation {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments by Cheng-Kai and myself: Project-OMOTES/orchestrator#83 (review)

Suggestion to rename to ParameterConstraint and only have 1 other_parameter.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or ref_parameter_key_name (more explicit)

string key_1 = 1;
string key_2 = 2;
RelationType relation = 3;

enum RelationType {
GREATER = 0;
GREATER_OR_EQ = 1;
SMALLER = 2;
SMALLER_OR_EQ = 3;
EQ = 4;
}
}

message Workflow {
string type_name = 1;
string type_description = 2;
repeated WorkflowParameter parameters = 3;
repeated ParameterRelation relations = 4;
}

message AvailableWorkflows {
Expand Down