Skip to content

Commit a622f0d

Browse files
committed
Update docker-based proto gen
1 parent 630f722 commit a622f0d

File tree

12 files changed

+93
-80
lines changed

12 files changed

+93
-80
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ jobs:
1616
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
1717
include:
1818
- os: ubuntu-latest
19-
python: "3.12"
19+
# TODO(cretz): Remove trailing patch version when
20+
# https://github.com/pydantic/pydantic/pull/9612 tagged
21+
python: "3.12.3"
2022
docsTarget: true
2123
- os: ubuntu-latest
2224
python: "3.8"
@@ -52,6 +54,11 @@ jobs:
5254
uses: deadsnakes/[email protected]
5355
with:
5456
python-version: ${{ matrix.python }}
57+
- uses: arduino/setup-protoc@v3
58+
with:
59+
# TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed
60+
version: "23.x"
61+
repo-token: ${{ secrets.GITHUB_TOKEN }}
5562
# Using fixed Poetry version until
5663
# https://github.com/python-poetry/poetry/issues/7611 and
5764
# https://github.com/python-poetry/poetry/pull/7694 are fixed
@@ -74,8 +81,8 @@ jobs:
7481
env:
7582
TEMPORAL_TEST_PROTO3: 1
7683
run: |
77-
poetry add "protobuf<4"
78-
poe gen-protos
84+
docker build -f scripts/_proto/Dockerfile -t python-gen-proto .
85+
docker run --rm -v "${PWD}/temporalio/api:/api_new" -v "${PWD}/temporalio/bridge/proto:/bridge_new" python-gen-proto
7986
poe format
8087
[[ -z $(git status --porcelain temporalio) ]] || (git diff temporalio; echo "Protos changed"; exit 1)
8188
poe test -s -o log_cli_level=DEBUG

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,10 @@ poe test -s --log-cli-level=DEBUG -k test_sync_activity_thread_cancel_caught
14691469

14701470
#### Proto Generation and Testing
14711471

1472-
To allow for backwards compatibility, protobuf code is generated on the 3.x series of the protobuf library. To generate
1472+
To allow for backwards compatibility, protobuf code is generated on the 3.x series of the protobuf library. This means
1473+
we must generate proto code on older Python and older protobuf (pre 4.x).
1474+
1475+
To generate
14731476
protobuf code, you must be on Python <= 3.10, and then run `poetry add "protobuf<4"`. Then the protobuf files can be
14741477
generated via `poe gen-protos`. Tests can be run for protobuf version 3 by setting the `TEMPORAL_TEST_PROTO3` env var
14751478
to `1` prior to running tests.
@@ -1484,6 +1487,8 @@ docker run --rm -v "${PWD}/temporalio/api:/api_new" -v "${PWD}/temporalio/bridge
14841487
poe format
14851488
```
14861489

1490+
Can use `%CD%` instead of `${PWD}` on Windows.
1491+
14871492
### Style
14881493

14891494
* Mostly [Google Style Guide](https://google.github.io/styleguide/pyguide.html). Notable exceptions:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ environment = { PATH = "$PATH:$HOME/.cargo/bin", CARGO_NET_GIT_FETCH_WITH_CLI =
123123
[tool.isort]
124124
profile = "black"
125125
skip_gitignore = true
126+
extend_skip = ["./temporalio/bridge/sdk-core", "./temporalio/bridge/target"]
126127

127128
[tool.mypy]
128129
ignore_missing_imports = true

temporalio/api/common/v1/message_pb2.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class MeteringMetadata(google.protobuf.message.Message):
421421
"""Count of local activities which have begun an execution attempt during this workflow task,
422422
and whose first attempt occurred in some previous task. This is used for metering
423423
purposes, and does not affect workflow state.
424-
424+
425425
(-- api-linter: core::0141::forbidden-types=disabled
426426
aip.dev/not-precedent: Negative values make no sense to represent. --)
427427
"""

temporalio/api/enums/v1/failed_cause_pb2.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class _WorkflowTaskFailedCauseEnumTypeWrapper(
8888
of their workflow. We do this to ensure that the state of their workflow does not become too
8989
large because that can cause severe performance degradation. You can modify the thresholds for
9090
each of these errors within your dynamic config.
91-
91+
9292
Spawning a new child workflow would cause this workflow to exceed its limit of pending child
9393
workflows.
9494
"""

temporalio/api/enums/v1/task_queue_pb2.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ class _TaskQueueKindEnumTypeWrapper(
5050
TASK_QUEUE_KIND_UNSPECIFIED: _TaskQueueKind.ValueType # 0
5151
TASK_QUEUE_KIND_NORMAL: _TaskQueueKind.ValueType # 1
5252
"""Tasks from a normal workflow task queue always include complete workflow history
53-
53+
5454
The task queue specified by the user is always a normal task queue. There can be as many
5555
workers as desired for a single normal task queue. All those workers may pick up tasks from
5656
that queue.
5757
"""
5858
TASK_QUEUE_KIND_STICKY: _TaskQueueKind.ValueType # 2
5959
"""A sticky queue only includes new history since the last workflow task, and they are
6060
per-worker.
61-
61+
6262
Sticky queues are created dynamically by each worker during their start up. They only exist
6363
for the lifetime of the worker process. Tasks in a sticky task queue are only available to
6464
the worker that created the sticky queue.
65-
65+
6666
Sticky queues are only for workflow tasks. There are no sticky task queues for activities.
6767
"""
6868

temporalio/api/operatorservice/v1/service_pb2_grpc.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class OperatorServiceStub:
4141
temporalio.api.operatorservice.v1.request_response_pb2.AddSearchAttributesResponse,
4242
]
4343
"""AddSearchAttributes add custom search attributes.
44-
44+
4545
Returns ALREADY_EXISTS status code if a Search Attribute with any of the specified names already exists
4646
Returns INTERNAL status code with temporalio.api.errordetails.v1.SystemWorkflowFailure in Error Details if registration process fails,
4747
"""
@@ -50,7 +50,7 @@ class OperatorServiceStub:
5050
temporalio.api.operatorservice.v1.request_response_pb2.RemoveSearchAttributesResponse,
5151
]
5252
"""RemoveSearchAttributes removes custom search attributes.
53-
53+
5454
Returns NOT_FOUND status code if a Search Attribute with any of the specified names is not registered
5555
"""
5656
ListSearchAttributes: grpc.UnaryUnaryMultiCallable[

temporalio/api/schedule/v1/message_pb2.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,26 +410,26 @@ class ScheduleSpec(google.protobuf.message.Message):
410410
"""
411411
timezone_name: builtins.str
412412
"""Time zone to interpret all calendar-based specs in.
413-
413+
414414
If unset, defaults to UTC. We recommend using UTC for your application if
415415
at all possible, to avoid various surprising properties of time zones.
416-
416+
417417
Time zones may be provided by name, corresponding to names in the IANA
418418
time zone database (see https://www.iana.org/time-zones). The definition
419419
will be loaded by the Temporal server from the environment it runs in.
420-
420+
421421
If your application requires more control over the time zone definition
422422
used, it may pass in a complete definition in the form of a TZif file
423423
from the time zone database. If present, this will be used instead of
424424
loading anything from the environment. You are then responsible for
425425
updating timezone_data when the definition changes.
426-
426+
427427
Calendar spec matching is based on literal matching of the clock time
428428
with no special handling of DST: if you write a calendar spec that fires
429429
at 2:30am and specify a time zone that follows DST, that action will not
430430
be triggered on the day that has no 2:30am. Similarly, an action that
431431
fires at 1:30am will be triggered twice on the day that has two 1:30s.
432-
432+
433433
Also note that no actions are taken on leap-seconds (e.g. 23:59:60 UTC).
434434
"""
435435
timezone_data: builtins.bytes

temporalio/api/sdk/v1/task_complete_metadata_pb2.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class WorkflowTaskCompletedMetadata(google.protobuf.message.Message):
8383
"""Name of the SDK that processed the task. This is usually something like "temporal-go" and is
8484
usually the same as client-name gRPC header. This should only be set if its value changed
8585
since the last time recorded on the workflow (or be set on the first task).
86-
86+
8787
(-- api-linter: core::0122::name-suffix=disabled
8888
aip.dev/not-precedent: We're ok with a name suffix here. --)
8989
"""

temporalio/api/testservice/v1/service_pb2_grpc.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ class TestServiceStub:
4141
temporalio.api.testservice.v1.request_response_pb2.LockTimeSkippingResponse,
4242
]
4343
"""LockTimeSkipping increments Time Locking Counter by one.
44-
44+
4545
If Time Locking Counter is positive, time skipping is locked (disabled).
4646
When time skipping is disabled, the time in test server is moving normally, with a real time pace.
4747
Test Server is typically started with locked time skipping and Time Locking Counter = 1.
48-
48+
4949
LockTimeSkipping and UnlockTimeSkipping calls are counted.
5050
"""
5151
UnlockTimeSkipping: grpc.UnaryUnaryMultiCallable[
5252
temporalio.api.testservice.v1.request_response_pb2.UnlockTimeSkippingRequest,
5353
temporalio.api.testservice.v1.request_response_pb2.UnlockTimeSkippingResponse,
5454
]
5555
"""UnlockTimeSkipping decrements Time Locking Counter by one.
56-
56+
5757
If the counter reaches 0, it unlocks time skipping and fast forwards time.
5858
LockTimeSkipping and UnlockTimeSkipping calls are counted. Calling UnlockTimeSkipping does not
5959
guarantee that time is going to be fast forwarded as another lock can be holding it.
60-
60+
6161
Time Locking Counter can't be negative, unbalanced calls to UnlockTimeSkipping will lead to rpc call failure
6262
"""
6363
Sleep: grpc.UnaryUnaryMultiCallable[
@@ -81,9 +81,9 @@ class TestServiceStub:
8181
]
8282
"""UnlockTimeSkippingWhileSleep decreases time locking counter by one and increases it back
8383
once the Test Server Time advances by the duration specified in the request.
84-
84+
8585
This call returns only when the Test Server Time advances by the specified duration.
86-
86+
8787
If it is called when Time Locking Counter is
8888
- more than 1 and no other unlocks are coming in, rpc call will block for the specified duration, time will not be fast forwarded.
8989
- 1, it will lead to fast forwarding of the time by the duration specified in the request and quick return of this rpc call.
@@ -94,7 +94,7 @@ class TestServiceStub:
9494
temporalio.api.testservice.v1.request_response_pb2.GetCurrentTimeResponse,
9595
]
9696
"""GetCurrentTime returns the current Temporal Test Server time
97-
97+
9898
This time might not be equal to {@link System#currentTimeMillis()} due to time skipping.
9999
"""
100100

temporalio/api/workflowservice/v1/request_response_pb2.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,13 @@ class StartWorkflowExecutionRequest(google.protobuf.message.Message):
575575
workflow_id_reuse_policy: temporalio.api.enums.v1.workflow_pb2.WorkflowIdReusePolicy.ValueType
576576
"""Defines whether to allow re-using the workflow id from a previously *closed* workflow.
577577
The default policy is WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE.
578-
578+
579579
See `workflow_id_conflict_policy` for handling a workflow id duplication with a *running* workflow.
580580
"""
581581
workflow_id_conflict_policy: temporalio.api.enums.v1.workflow_pb2.WorkflowIdConflictPolicy.ValueType
582582
"""Defines how to resolve a workflow id conflict with a *running* workflow.
583583
The default policy is WORKFLOW_ID_CONFLICT_POLICY_FAIL.
584-
584+
585585
See `workflow_id_reuse_policy` for handling a workflow id duplication with a *closed* workflow.
586586
"""
587587
@property
@@ -2601,14 +2601,14 @@ class SignalWithStartWorkflowExecutionRequest(google.protobuf.message.Message):
26012601
workflow_id_reuse_policy: temporalio.api.enums.v1.workflow_pb2.WorkflowIdReusePolicy.ValueType
26022602
"""Defines whether to allow re-using the workflow id from a previously *closed* workflow.
26032603
The default policy is WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE.
2604-
2604+
26052605
See `workflow_id_reuse_policy` for handling a workflow id duplication with a *running* workflow.
26062606
"""
26072607
workflow_id_conflict_policy: temporalio.api.enums.v1.workflow_pb2.WorkflowIdConflictPolicy.ValueType
26082608
"""Defines how to resolve a workflow id conflict with a *running* workflow.
26092609
The default policy is WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING.
26102610
Note that WORKFLOW_ID_CONFLICT_POLICY_FAIL is an invalid option.
2611-
2611+
26122612
See `workflow_id_reuse_policy` for handling a workflow id duplication with a *closed* workflow.
26132613
"""
26142614
signal_name: builtins.str
@@ -4149,7 +4149,7 @@ class GetSystemInfoResponse(google.protobuf.message.Message):
41494149
internal_error_differentiation: builtins.bool
41504150
"""True if internal errors are differentiated from other types of errors for purposes of
41514151
retrying non-internal errors.
4152-
4152+
41534153
When unset/false, clients retry all failures. When true, clients should only retry
41544154
non-internal errors.
41554155
"""
@@ -4915,7 +4915,7 @@ class UpdateWorkerBuildIdCompatibilityRequest(google.protobuf.message.Message):
49154915
"""A new build id. This operation will create a new set which will be the new overall
49164916
default version for the queue, with this id as its only member. This new set is
49174917
incompatible with all previous sets/versions.
4918-
4918+
49194919
(-- api-linter: core::0140::prepositions=disabled
49204920
aip.dev/not-precedent: In makes perfect sense here. --)
49214921
"""
@@ -4927,13 +4927,13 @@ class UpdateWorkerBuildIdCompatibilityRequest(google.protobuf.message.Message):
49274927
promote_set_by_build_id: builtins.str
49284928
"""Promote an existing set to be the current default (if it isn't already) by targeting
49294929
an existing build id within it. This field's value is the extant build id.
4930-
4930+
49314931
(-- api-linter: core::0140::prepositions=disabled
49324932
aip.dev/not-precedent: Names are hard. --)
49334933
"""
49344934
promote_build_id_within_set: builtins.str
49354935
"""Promote an existing build id within some set to be the current default for that set.
4936-
4936+
49374937
(-- api-linter: core::0140::prepositions=disabled
49384938
aip.dev/not-precedent: Within makes perfect sense here. --)
49394939
"""

0 commit comments

Comments
 (0)