Skip to content

Commit

Permalink
Merge pull request #8 from elena-kolevska/protos
Browse files Browse the repository at this point in the history
Update protos
  • Loading branch information
elena-kolevska authored Feb 7, 2025
2 parents 6ef52fc + e5057f3 commit e86fc77
Show file tree
Hide file tree
Showing 9 changed files with 393 additions and 201 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Protos are compiled with gRPC 1.62.3 / protobuf 3.25.X instead of the latest release. This ensures compatibility with a wider range of grpcio versions for better compatibility with other packages / libraries ([#36](https://github.com/microsoft/durabletask-python/pull/36)) - by [@berndverst](https://github.com/berndverst)
- Http and grpc protocols and their secure variants are stripped from the host name parameter if provided. Secure mode is enabled if the protocol provided is https or grpcs ([#38](https://github.com/microsoft/durabletask-python/pull/38) - by [@berndverst)(https://github.com/berndverst)
- Improve ProtoGen by downloading proto file directly instead of using submodule ([#39](https://github.com/microsoft/durabletask-python/pull/39) - by [@berndverst](https://github.com/berndverst)

### Updates

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ install:
python3 -m pip install .

gen-proto:
cp ./submodules/durabletask-protobuf/protos/orchestrator_service.proto durabletask/internal/orchestrator_service.proto
curl -o durabletask/internal/orchestrator_service.proto https://raw.githubusercontent.com/microsoft/durabletask-protobuf/refs/heads/main/protos/orchestrator_service.proto
curl -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/microsoft/durabletask-protobuf/commits?path=protos/orchestrator_service.proto&sha=main&per_page=1" | jq -r '.[0].sha' >> durabletask/internal/PROTO_SOURCE_COMMIT_HASH
python3 -m grpc_tools.protoc --proto_path=. --python_out=. --pyi_out=. --grpc_python_out=. ./durabletask/internal/orchestrator_service.proto
rm durabletask/internal/*.proto

Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,13 @@ The following is more information about how to develop this project. Note that d

### Generating protobufs

Protobuf definitions are stored in the [./submodules/durabletask-proto](./submodules/durabletask-proto) directory, which is a submodule. To update the submodule, run the following command from the project root:

```sh
git submodule update --init
```

Once the submodule is available, the corresponding source code can be regenerated using the following command from the project root:

```sh
pip3 install -r dev-requirements.txt
make gen-proto
```

This will download the `orchestrator_service.proto` from the `microsoft/durabletask-protobuf` repo and compile it using `grpcio-tools`. The version of the source proto file that was downloaded can be found in the file `durabletask/internal/PROTO_SOURCE_COMMIT_HASH`.

### Running unit tests

Unit tests can be run using the following command from the project root. Unit tests _don't_ require a sidecar process to be running.
Expand Down
1 change: 1 addition & 0 deletions durabletask/internal/PROTO_SOURCE_COMMIT_HASH
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c672a0dc97c06587d7399ee12f1c5b0b9fc492a7c672a0dc97c06587d7399ee12f1c5b0b9fc492a7
374 changes: 198 additions & 176 deletions durabletask/internal/orchestrator_service_pb2.py

Large diffs are not rendered by default.

167 changes: 155 additions & 12 deletions durabletask/internal/orchestrator_service_pb2.pyi

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions durabletask/internal/orchestrator_service_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ def __init__(self, channel):
request_serializer=durabletask_dot_internal_dot_orchestrator__service__pb2.EntityBatchResult.SerializeToString,
response_deserializer=durabletask_dot_internal_dot_orchestrator__service__pb2.CompleteTaskResponse.FromString,
)
self.StreamInstanceHistory = channel.unary_stream(
'/TaskHubSidecarService/StreamInstanceHistory',
request_serializer=durabletask_dot_internal_dot_orchestrator__service__pb2.StreamInstanceHistoryRequest.SerializeToString,
response_deserializer=durabletask_dot_internal_dot_orchestrator__service__pb2.HistoryChunk.FromString,
)
self.CreateTaskHub = channel.unary_unary(
'/TaskHubSidecarService/CreateTaskHub',
request_serializer=durabletask_dot_internal_dot_orchestrator__service__pb2.CreateTaskHubRequest.SerializeToString,
Expand Down Expand Up @@ -238,6 +243,13 @@ def CompleteEntityTask(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def StreamInstanceHistory(self, request, context):
"""Gets the history of an orchestration instance as a stream of events.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def CreateTaskHub(self, request, context):
"""Deletes and Creates the necessary resources for the orchestration service and the instance store
"""
Expand Down Expand Up @@ -363,6 +375,11 @@ def add_TaskHubSidecarServiceServicer_to_server(servicer, server):
request_deserializer=durabletask_dot_internal_dot_orchestrator__service__pb2.EntityBatchResult.FromString,
response_serializer=durabletask_dot_internal_dot_orchestrator__service__pb2.CompleteTaskResponse.SerializeToString,
),
'StreamInstanceHistory': grpc.unary_stream_rpc_method_handler(
servicer.StreamInstanceHistory,
request_deserializer=durabletask_dot_internal_dot_orchestrator__service__pb2.StreamInstanceHistoryRequest.FromString,
response_serializer=durabletask_dot_internal_dot_orchestrator__service__pb2.HistoryChunk.SerializeToString,
),
'CreateTaskHub': grpc.unary_unary_rpc_method_handler(
servicer.CreateTaskHub,
request_deserializer=durabletask_dot_internal_dot_orchestrator__service__pb2.CreateTaskHubRequest.FromString,
Expand Down Expand Up @@ -675,6 +692,23 @@ def CompleteEntityTask(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def StreamInstanceHistory(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_stream(request, target, '/TaskHubSidecarService/StreamInstanceHistory',
durabletask_dot_internal_dot_orchestrator__service__pb2.StreamInstanceHistoryRequest.SerializeToString,
durabletask_dot_internal_dot_orchestrator__service__pb2.HistoryChunk.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def CreateTaskHub(request,
target,
Expand Down
1 change: 0 additions & 1 deletion submodules/durabletask-protobuf
Submodule durabletask-protobuf deleted from c7d8cd

0 comments on commit e86fc77

Please sign in to comment.