Skip to content

Commit

Permalink
Custom slot suppliers (#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sushisource authored Nov 20, 2024
1 parent 001ce8b commit 042e088
Show file tree
Hide file tree
Showing 52 changed files with 3,875 additions and 975 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
python: "3.12"
docsTarget: true
cloudTestTarget: true
clippyLinter: true
- os: ubuntu-latest
python: "3.8"
protoCheckTarget: true
Expand Down Expand Up @@ -58,6 +59,8 @@ jobs:
# https://github.com/python-poetry/poetry/pull/7694 are fixed
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
- run: poetry install --no-root --all-extras
- run: poe bridge-lint
if: ${{ matrix.clippyLinter }}
- run: poe lint
- run: poe build-develop
- run: mkdir junit-xml
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ temporalio/bridge/temporal_sdk_bridge*
/tests/helpers/golangserver/golangserver
/tests/helpers/golangworker/golangworker
/.idea
/sdk-python.iml
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ lint = [
{cmd = "pyright"},
{ref = "lint-docs"},
]
bridge-lint = { cmd = "cargo clippy -- -D warnings", cwd = "temporalio/bridge" }
# TODO(cretz): Why does pydocstyle complain about @overload missing docs after
# https://github.com/PyCQA/pydocstyle/pull/511?
lint-docs = "pydocstyle --ignore-decorators=overload"
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions temporalio/api/activity/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .message_pb2 import ActivityOptions

__all__ = [
"ActivityOptions",
]
48 changes: 48 additions & 0 deletions temporalio/api/activity/v1/message_pb2.py

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

132 changes: 132 additions & 0 deletions temporalio/api/activity/v1/message_pb2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
The MIT License
Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

import builtins
import sys

import google.protobuf.descriptor
import google.protobuf.duration_pb2
import google.protobuf.message

import temporalio.api.common.v1.message_pb2
import temporalio.api.taskqueue.v1.message_pb2

if sys.version_info >= (3, 8):
import typing as typing_extensions
else:
import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

class ActivityOptions(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor

TASK_QUEUE_FIELD_NUMBER: builtins.int
SCHEDULE_TO_CLOSE_TIMEOUT_FIELD_NUMBER: builtins.int
SCHEDULE_TO_START_TIMEOUT_FIELD_NUMBER: builtins.int
START_TO_CLOSE_TIMEOUT_FIELD_NUMBER: builtins.int
HEARTBEAT_TIMEOUT_FIELD_NUMBER: builtins.int
RETRY_POLICY_FIELD_NUMBER: builtins.int
@property
def task_queue(self) -> temporalio.api.taskqueue.v1.message_pb2.TaskQueue: ...
@property
def schedule_to_close_timeout(self) -> google.protobuf.duration_pb2.Duration:
"""Indicates how long the caller is willing to wait for an activity completion. Limits how long
retries will be attempted. Either this or `start_to_close_timeout` must be specified.
(-- api-linter: core::0140::prepositions=disabled
aip.dev/not-precedent: "to" is used to indicate interval. --)
"""
@property
def schedule_to_start_timeout(self) -> google.protobuf.duration_pb2.Duration:
"""Limits time an activity task can stay in a task queue before a worker picks it up. This
timeout is always non retryable, as all a retry would achieve is to put it back into the same
queue. Defaults to `schedule_to_close_timeout` or workflow execution timeout if not
specified.
(-- api-linter: core::0140::prepositions=disabled
aip.dev/not-precedent: "to" is used to indicate interval. --)
"""
@property
def start_to_close_timeout(self) -> google.protobuf.duration_pb2.Duration:
"""Maximum time an activity is allowed to execute after being picked up by a worker. This
timeout is always retryable. Either this or `schedule_to_close_timeout` must be
specified.
(-- api-linter: core::0140::prepositions=disabled
aip.dev/not-precedent: "to" is used to indicate interval. --)
"""
@property
def heartbeat_timeout(self) -> google.protobuf.duration_pb2.Duration:
"""Maximum permitted time between successful worker heartbeats."""
@property
def retry_policy(self) -> temporalio.api.common.v1.message_pb2.RetryPolicy: ...
def __init__(
self,
*,
task_queue: temporalio.api.taskqueue.v1.message_pb2.TaskQueue | None = ...,
schedule_to_close_timeout: google.protobuf.duration_pb2.Duration | None = ...,
schedule_to_start_timeout: google.protobuf.duration_pb2.Duration | None = ...,
start_to_close_timeout: google.protobuf.duration_pb2.Duration | None = ...,
heartbeat_timeout: google.protobuf.duration_pb2.Duration | None = ...,
retry_policy: temporalio.api.common.v1.message_pb2.RetryPolicy | None = ...,
) -> None: ...
def HasField(
self,
field_name: typing_extensions.Literal[
"heartbeat_timeout",
b"heartbeat_timeout",
"retry_policy",
b"retry_policy",
"schedule_to_close_timeout",
b"schedule_to_close_timeout",
"schedule_to_start_timeout",
b"schedule_to_start_timeout",
"start_to_close_timeout",
b"start_to_close_timeout",
"task_queue",
b"task_queue",
],
) -> builtins.bool: ...
def ClearField(
self,
field_name: typing_extensions.Literal[
"heartbeat_timeout",
b"heartbeat_timeout",
"retry_policy",
b"retry_policy",
"schedule_to_close_timeout",
b"schedule_to_close_timeout",
"schedule_to_start_timeout",
b"schedule_to_start_timeout",
"start_to_close_timeout",
b"start_to_close_timeout",
"task_queue",
b"task_queue",
],
) -> None: ...

global___ActivityOptions = ActivityOptions
2 changes: 2 additions & 0 deletions temporalio/api/common/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Callback,
DataBlob,
Header,
Link,
Memo,
MeteringMetadata,
Payload,
Expand All @@ -23,6 +24,7 @@
"DataBlob",
"GrpcStatus",
"Header",
"Link",
"Memo",
"MeteringMetadata",
"Payload",
Expand Down
Loading

0 comments on commit 042e088

Please sign in to comment.