Skip to content

Commit b92dc52

Browse files
authored
Improve Proto Generation: Download proto file directly instead of via submodule (#39)
1 parent 29227d3 commit b92dc52

File tree

7 files changed

+196
-192
lines changed

7 files changed

+196
-192
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
- 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)
1818
- 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)
19+
- 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)
1920

2021
### Updates
2122

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ install:
1111
python3 -m pip install .
1212

1313
gen-proto:
14-
cp ./submodules/durabletask-protobuf/protos/orchestrator_service.proto durabletask/internal/orchestrator_service.proto
14+
curl -o durabletask/internal/orchestrator_service.proto https://raw.githubusercontent.com/microsoft/durabletask-protobuf/refs/heads/main/protos/orchestrator_service.proto
15+
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
1516
python3 -m grpc_tools.protoc --proto_path=. --python_out=. --pyi_out=. --grpc_python_out=. ./durabletask/internal/orchestrator_service.proto
1617
rm durabletask/internal/*.proto
1718

README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,13 @@ The following is more information about how to develop this project. Note that d
161161

162162
### Generating protobufs
163163

164-
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:
165-
166-
```sh
167-
git submodule update --init
168-
```
169-
170-
Once the submodule is available, the corresponding source code can be regenerated using the following command from the project root:
171-
172164
```sh
173165
pip3 install -r dev-requirements.txt
174166
make gen-proto
175167
```
176168

169+
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`.
170+
177171
### Running unit tests
178172

179173
Unit tests can be run using the following command from the project root. Unit tests _don't_ require a sidecar process to be running.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
443b333f4f65a438dc9eb4f090560d232afec4b7

durabletask/internal/orchestrator_service_pb2.py

+176-176
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

durabletask/internal/orchestrator_service_pb2.pyi

+14-6
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,18 @@ class ActivityRequest(_message.Message):
6363
def __init__(self, name: _Optional[str] = ..., version: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., input: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., orchestrationInstance: _Optional[_Union[OrchestrationInstance, _Mapping]] = ..., taskId: _Optional[int] = ..., parentTraceContext: _Optional[_Union[TraceContext, _Mapping]] = ...) -> None: ...
6464

6565
class ActivityResponse(_message.Message):
66-
__slots__ = ("instanceId", "taskId", "result", "failureDetails")
66+
__slots__ = ("instanceId", "taskId", "result", "failureDetails", "completionToken")
6767
INSTANCEID_FIELD_NUMBER: _ClassVar[int]
6868
TASKID_FIELD_NUMBER: _ClassVar[int]
6969
RESULT_FIELD_NUMBER: _ClassVar[int]
7070
FAILUREDETAILS_FIELD_NUMBER: _ClassVar[int]
71+
COMPLETIONTOKEN_FIELD_NUMBER: _ClassVar[int]
7172
instanceId: str
7273
taskId: int
7374
result: _wrappers_pb2.StringValue
7475
failureDetails: TaskFailureDetails
75-
def __init__(self, instanceId: _Optional[str] = ..., taskId: _Optional[int] = ..., result: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., failureDetails: _Optional[_Union[TaskFailureDetails, _Mapping]] = ...) -> None: ...
76+
completionToken: str
77+
def __init__(self, instanceId: _Optional[str] = ..., taskId: _Optional[int] = ..., result: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., failureDetails: _Optional[_Union[TaskFailureDetails, _Mapping]] = ..., completionToken: _Optional[str] = ...) -> None: ...
7678

7779
class TaskFailureDetails(_message.Message):
7880
__slots__ = ("errorType", "errorMessage", "stackTrace", "innerFailure", "isNonRetriable")
@@ -421,14 +423,16 @@ class OrchestratorRequest(_message.Message):
421423
def __init__(self, instanceId: _Optional[str] = ..., executionId: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., pastEvents: _Optional[_Iterable[_Union[HistoryEvent, _Mapping]]] = ..., newEvents: _Optional[_Iterable[_Union[HistoryEvent, _Mapping]]] = ..., entityParameters: _Optional[_Union[OrchestratorEntityParameters, _Mapping]] = ...) -> None: ...
422424

423425
class OrchestratorResponse(_message.Message):
424-
__slots__ = ("instanceId", "actions", "customStatus")
426+
__slots__ = ("instanceId", "actions", "customStatus", "completionToken")
425427
INSTANCEID_FIELD_NUMBER: _ClassVar[int]
426428
ACTIONS_FIELD_NUMBER: _ClassVar[int]
427429
CUSTOMSTATUS_FIELD_NUMBER: _ClassVar[int]
430+
COMPLETIONTOKEN_FIELD_NUMBER: _ClassVar[int]
428431
instanceId: str
429432
actions: _containers.RepeatedCompositeFieldContainer[OrchestratorAction]
430433
customStatus: _wrappers_pb2.StringValue
431-
def __init__(self, instanceId: _Optional[str] = ..., actions: _Optional[_Iterable[_Union[OrchestratorAction, _Mapping]]] = ..., customStatus: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ...) -> None: ...
434+
completionToken: str
435+
def __init__(self, instanceId: _Optional[str] = ..., actions: _Optional[_Iterable[_Union[OrchestratorAction, _Mapping]]] = ..., customStatus: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., completionToken: _Optional[str] = ...) -> None: ...
432436

433437
class CreateInstanceRequest(_message.Message):
434438
__slots__ = ("instanceId", "name", "version", "input", "scheduledStartTimestamp", "orchestrationIdReusePolicy", "executionId", "tags")
@@ -856,8 +860,12 @@ class StartNewOrchestrationAction(_message.Message):
856860
def __init__(self, instanceId: _Optional[str] = ..., name: _Optional[str] = ..., version: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., input: _Optional[_Union[_wrappers_pb2.StringValue, _Mapping]] = ..., scheduledTime: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ...
857861

858862
class GetWorkItemsRequest(_message.Message):
859-
__slots__ = ()
860-
def __init__(self) -> None: ...
863+
__slots__ = ("maxConcurrentOrchestrationWorkItems", "maxConcurrentActivityWorkItems")
864+
MAXCONCURRENTORCHESTRATIONWORKITEMS_FIELD_NUMBER: _ClassVar[int]
865+
MAXCONCURRENTACTIVITYWORKITEMS_FIELD_NUMBER: _ClassVar[int]
866+
maxConcurrentOrchestrationWorkItems: int
867+
maxConcurrentActivityWorkItems: int
868+
def __init__(self, maxConcurrentOrchestrationWorkItems: _Optional[int] = ..., maxConcurrentActivityWorkItems: _Optional[int] = ...) -> None: ...
861869

862870
class WorkItem(_message.Message):
863871
__slots__ = ("orchestratorRequest", "activityRequest", "entityRequest", "healthPing", "completionToken")

submodules/durabletask-protobuf

Submodule durabletask-protobuf deleted from c7d8cd8

0 commit comments

Comments
 (0)