Skip to content

test(taskworker): Allow test tasks to have arbitary arguments #91881

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

Merged
merged 1 commit into from
May 19, 2025
Merged
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
5 changes: 3 additions & 2 deletions src/sentry/taskworker/tasks/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
from time import sleep
from typing import Any

from sentry.taskworker.namespaces import exampletasks
from sentry.taskworker.retry import LastAction, NoRetriesRemainingError, Retry, RetryError
Expand All @@ -12,7 +13,7 @@


@exampletasks.register(name="examples.say_hello")
def say_hello(name: str) -> None:
def say_hello(name: str, *args: list[Any], **kwargs: dict[str, Any]) -> None:
logger.debug("Hello %s", name)


Expand Down Expand Up @@ -83,6 +84,6 @@ def at_most_once_task() -> None:


@exampletasks.register(name="examples.timed")
def timed_task(sleep_seconds: float | str) -> None:
def timed_task(sleep_seconds: float | str, *args: list[Any], **kwargs: dict[str, Any]) -> None:
sleep(float(sleep_seconds))
logger.debug("timed_task complete")
Loading