Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect signatures of late-registered handlers #616

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,25 @@ jobs:
- run: poetry install --no-root --all-extras
- run: poe lint
- run: poe build-develop
- run: poe test -s -o log_cli_level=DEBUG
- run: mkdir junit-xml
- run: poe test -s -o log_cli_level=DEBUG --junit-xml=junit-xml/${{ matrix.python }}-${{ matrix.os }}.xml
# Time skipping doesn't yet support ARM
- if: ${{ !endsWith(matrix.os, '-arm') }}
run: poe test -s -o log_cli_level=DEBUG --workflow-environment time-skipping
run: poe test -s -o log_cli_level=DEBUG --workflow-environment time-skipping --junit-xml=junit-xml/${{ matrix.python }}-${{ matrix.os }}-time-skipping.xml
# Check cloud if proper target and not on fork
- if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-python') }}
run: poe test -s -o log_cli_level=DEBUG -k test_cloud_client
run: poe test -s -o log_cli_level=DEBUG -k test_cloud_client --junit-xml=junit-xml/${{ matrix.python }}-${{ matrix.os }}-cloud.xml
env:
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: 2024-05-13-00
TEMPORAL_CLIENT_CLOUD_NAMESPACE: sdk-ci.a2dd6
- name: "Upload junit-xml artifacts"
uses: actions/upload-artifact@v4
if: always()
with:
name: junit-xml-${{ matrix.python }}-${{ matrix.os }}
path: junit-xml
retention-days: 30

# Confirm protos are already generated properly with older protobuf
# library and run test with that older version. We must downgrade protobuf
Expand Down
12 changes: 4 additions & 8 deletions tests/worker/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5426,26 +5426,22 @@ async def run(
if handler_registration == "-late-registered-":
if handler_dynamism == "-dynamic-":

async def my_late_registered_dynamic_update(
self, name: str, args: Sequence[RawValue]
) -> str:
async def my_late_registered_dynamic_update(*args, **kwargs) -> str:
await workflow.wait_condition(lambda: self.handlers_may_finish)
return "my-late-registered-dynamic-update-result"

async def my_late_registered_dynamic_signal(
self, name: str, args: Sequence[RawValue]
) -> None:
async def my_late_registered_dynamic_signal(*args, **kwargs) -> None:
await workflow.wait_condition(lambda: self.handlers_may_finish)

workflow.set_dynamic_update_handler(my_late_registered_dynamic_update)
workflow.set_dynamic_signal_handler(my_late_registered_dynamic_signal)
else:

async def my_late_registered_update(self) -> str:
async def my_late_registered_update() -> str:
await workflow.wait_condition(lambda: self.handlers_may_finish)
return "my-late-registered-update-result"

async def my_late_registered_signal(self) -> None:
async def my_late_registered_signal() -> None:
await workflow.wait_condition(lambda: self.handlers_may_finish)

workflow.set_update_handler(
Expand Down
Loading