Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ dependencies = [
"statsd>=3.3.0",
"structlog>=22.1.0",
"symbolic>=13.1.1",
"taskbroker-client>=0.18.6",
"taskbroker-client>=0.19.1",
"tiktoken>=0.8.0",
"tokenizers>=0.22.0",
"tldextract>=5.1.2",
Expand Down
23 changes: 22 additions & 1 deletion src/sentry/runner/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def taskworker_scheduler(redis_cluster: str, **options: Any) -> None:
@click.option(
"--push-mode", help="Whether to run in PUSH or PULL mode.", default=False, is_flag=True
)
@click.option(
"--batch-push-mode", help="Whether to run in BATCH PUSH mode.", default=False, is_flag=True
)
@click.option(
"--rpc-host",
help="The hostname and port for the taskbroker gRPC server. When using num-brokers the hostname will be appended with `-{i}` to connect to individual brokers.",
Expand Down Expand Up @@ -213,6 +216,7 @@ def taskworker(**options: Any) -> None:

def run_taskworker(
push_mode: bool,
batch_push_mode: bool,
worker_rpc_port: int,
rpc_host: str,
num_brokers: int | None,
Expand All @@ -232,7 +236,7 @@ def run_taskworker(
"""
taskworker factory that can be reloaded
"""
from taskbroker_client.worker import PushTaskWorker, TaskWorker
from taskbroker_client.worker import BatchPushTaskWorker, PushTaskWorker, TaskWorker
from taskbroker_client.worker.client import make_broker_hosts

with managed_bgtasks(role="taskworker"):
Expand All @@ -252,6 +256,23 @@ def run_taskworker(
health_check_sec_per_touch=health_check_sec_per_touch,
grpc_port=worker_rpc_port,
)
elif batch_push_mode:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Push mode overrides batch push

Medium Severity

If both --push-mode and --batch-push-mode are set, run_taskworker always constructs PushTaskWorker and never BatchPushTaskWorker, with no error. That can run the wrong worker type when flags or env config overlap.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d4cee4f. Configure here.

worker = BatchPushTaskWorker(
app_module="sentry.taskworker.bootstrap:app",
broker_service=rpc_host,
max_child_task_count=max_child_task_count,
namespace=namespace,
concurrency=concurrency,
child_tasks_queue_maxsize=child_tasks_queue_maxsize,
result_queue_maxsize=result_queue_maxsize,
rebalance_after=rebalance_after,
processing_pool_name=processing_pool_name,
pod_name=pod_name,
health_check_file_path=health_check_file_path,
health_check_sec_per_touch=health_check_sec_per_touch,
grpc_port=worker_rpc_port,
update_in_batches=True,
)
else:
worker = TaskWorker(
app_module="sentry.taskworker.bootstrap:app",
Expand Down
6 changes: 3 additions & 3 deletions uv.lock

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

Loading