Skip to content

Commit 042e088

Browse files
authored
Custom slot suppliers (#690)
1 parent 001ce8b commit 042e088

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3875
-975
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
python: "3.12"
2020
docsTarget: true
2121
cloudTestTarget: true
22+
clippyLinter: true
2223
- os: ubuntu-latest
2324
python: "3.8"
2425
protoCheckTarget: true
@@ -58,6 +59,8 @@ jobs:
5859
# https://github.com/python-poetry/poetry/pull/7694 are fixed
5960
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
6061
- run: poetry install --no-root --all-extras
62+
- run: poe bridge-lint
63+
if: ${{ matrix.clippyLinter }}
6164
- run: poe lint
6265
- run: poe build-develop
6366
- run: mkdir junit-xml

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ temporalio/bridge/temporal_sdk_bridge*
77
/tests/helpers/golangserver/golangserver
88
/tests/helpers/golangworker/golangworker
99
/.idea
10+
/sdk-python.iml

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ lint = [
8181
{cmd = "pyright"},
8282
{ref = "lint-docs"},
8383
]
84+
bridge-lint = { cmd = "cargo clippy -- -D warnings", cwd = "temporalio/bridge" }
8485
# TODO(cretz): Why does pydocstyle complain about @overload missing docs after
8586
# https://github.com/PyCQA/pydocstyle/pull/511?
8687
lint-docs = "pydocstyle --ignore-decorators=overload"

temporalio/api/activity/__init__.py

Whitespace-only changes.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from .message_pb2 import ActivityOptions
2+
3+
__all__ = [
4+
"ActivityOptions",
5+
]

temporalio/api/activity/v1/message_pb2.py

+48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
"""
2+
@generated by mypy-protobuf. Do not edit manually!
3+
isort:skip_file
4+
The MIT License
5+
6+
Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in
16+
all copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
THE SOFTWARE.
25+
"""
26+
27+
import builtins
28+
import sys
29+
30+
import google.protobuf.descriptor
31+
import google.protobuf.duration_pb2
32+
import google.protobuf.message
33+
34+
import temporalio.api.common.v1.message_pb2
35+
import temporalio.api.taskqueue.v1.message_pb2
36+
37+
if sys.version_info >= (3, 8):
38+
import typing as typing_extensions
39+
else:
40+
import typing_extensions
41+
42+
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
43+
44+
class ActivityOptions(google.protobuf.message.Message):
45+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
46+
47+
TASK_QUEUE_FIELD_NUMBER: builtins.int
48+
SCHEDULE_TO_CLOSE_TIMEOUT_FIELD_NUMBER: builtins.int
49+
SCHEDULE_TO_START_TIMEOUT_FIELD_NUMBER: builtins.int
50+
START_TO_CLOSE_TIMEOUT_FIELD_NUMBER: builtins.int
51+
HEARTBEAT_TIMEOUT_FIELD_NUMBER: builtins.int
52+
RETRY_POLICY_FIELD_NUMBER: builtins.int
53+
@property
54+
def task_queue(self) -> temporalio.api.taskqueue.v1.message_pb2.TaskQueue: ...
55+
@property
56+
def schedule_to_close_timeout(self) -> google.protobuf.duration_pb2.Duration:
57+
"""Indicates how long the caller is willing to wait for an activity completion. Limits how long
58+
retries will be attempted. Either this or `start_to_close_timeout` must be specified.
59+
60+
(-- api-linter: core::0140::prepositions=disabled
61+
aip.dev/not-precedent: "to" is used to indicate interval. --)
62+
"""
63+
@property
64+
def schedule_to_start_timeout(self) -> google.protobuf.duration_pb2.Duration:
65+
"""Limits time an activity task can stay in a task queue before a worker picks it up. This
66+
timeout is always non retryable, as all a retry would achieve is to put it back into the same
67+
queue. Defaults to `schedule_to_close_timeout` or workflow execution timeout if not
68+
specified.
69+
70+
(-- api-linter: core::0140::prepositions=disabled
71+
aip.dev/not-precedent: "to" is used to indicate interval. --)
72+
"""
73+
@property
74+
def start_to_close_timeout(self) -> google.protobuf.duration_pb2.Duration:
75+
"""Maximum time an activity is allowed to execute after being picked up by a worker. This
76+
timeout is always retryable. Either this or `schedule_to_close_timeout` must be
77+
specified.
78+
79+
(-- api-linter: core::0140::prepositions=disabled
80+
aip.dev/not-precedent: "to" is used to indicate interval. --)
81+
"""
82+
@property
83+
def heartbeat_timeout(self) -> google.protobuf.duration_pb2.Duration:
84+
"""Maximum permitted time between successful worker heartbeats."""
85+
@property
86+
def retry_policy(self) -> temporalio.api.common.v1.message_pb2.RetryPolicy: ...
87+
def __init__(
88+
self,
89+
*,
90+
task_queue: temporalio.api.taskqueue.v1.message_pb2.TaskQueue | None = ...,
91+
schedule_to_close_timeout: google.protobuf.duration_pb2.Duration | None = ...,
92+
schedule_to_start_timeout: google.protobuf.duration_pb2.Duration | None = ...,
93+
start_to_close_timeout: google.protobuf.duration_pb2.Duration | None = ...,
94+
heartbeat_timeout: google.protobuf.duration_pb2.Duration | None = ...,
95+
retry_policy: temporalio.api.common.v1.message_pb2.RetryPolicy | None = ...,
96+
) -> None: ...
97+
def HasField(
98+
self,
99+
field_name: typing_extensions.Literal[
100+
"heartbeat_timeout",
101+
b"heartbeat_timeout",
102+
"retry_policy",
103+
b"retry_policy",
104+
"schedule_to_close_timeout",
105+
b"schedule_to_close_timeout",
106+
"schedule_to_start_timeout",
107+
b"schedule_to_start_timeout",
108+
"start_to_close_timeout",
109+
b"start_to_close_timeout",
110+
"task_queue",
111+
b"task_queue",
112+
],
113+
) -> builtins.bool: ...
114+
def ClearField(
115+
self,
116+
field_name: typing_extensions.Literal[
117+
"heartbeat_timeout",
118+
b"heartbeat_timeout",
119+
"retry_policy",
120+
b"retry_policy",
121+
"schedule_to_close_timeout",
122+
b"schedule_to_close_timeout",
123+
"schedule_to_start_timeout",
124+
b"schedule_to_start_timeout",
125+
"start_to_close_timeout",
126+
b"start_to_close_timeout",
127+
"task_queue",
128+
b"task_queue",
129+
],
130+
) -> None: ...
131+
132+
global___ActivityOptions = ActivityOptions

temporalio/api/common/v1/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Callback,
55
DataBlob,
66
Header,
7+
Link,
78
Memo,
89
MeteringMetadata,
910
Payload,
@@ -23,6 +24,7 @@
2324
"DataBlob",
2425
"GrpcStatus",
2526
"Header",
27+
"Link",
2628
"Memo",
2729
"MeteringMetadata",
2830
"Payload",

0 commit comments

Comments
 (0)