From 8bf2303e08e9f9c21e007bb914a8a40774ebc2f5 Mon Sep 17 00:00:00 2001 From: james-mcnulty Date: Sun, 1 Feb 2026 12:01:58 -0800 Subject: [PATCH 1/3] Add Launchpad Stub (Called `process_something`) --- devenv/sync.py | 2 +- pyproject.toml | 2 +- src/sentry/preprod/tasks.py | 19 ++++++++++++++++++- src/sentry/taskworker/registry.py | 2 ++ src/sentry/taskworker/task.py | 3 +++ src/sentry/taskworker/worker.py | 1 + src/sentry/taskworker/workerchild.py | 1 + uv.lock | 11 +++++------ 8 files changed, 32 insertions(+), 9 deletions(-) diff --git a/devenv/sync.py b/devenv/sync.py index 806dfd4cfeb87c..eb66789d762bcb 100644 --- a/devenv/sync.py +++ b/devenv/sync.py @@ -288,7 +288,7 @@ def main(context: dict[str, str]) -> int: ( "docker", "exec", - "sentry-postgres-1", + "postgres-postgres-1", "psql", "sentry", "postgres", diff --git a/pyproject.toml b/pyproject.toml index fbcd57b58e9c04..c8c82258624b1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -171,7 +171,7 @@ dev = [ "pyupgrade>=3.19.1", "responses>=0.23.1", "selenium>=4.16.0", - "sentry-cli>=2.16.0", + "sentry-cli>=3.1.0", "sentry-covdefaults-disable-branch-coverage>=1.0.2", "sentry-devenv>=1.22.0", "sentry-forked-django-stubs>=5.2.2.post2", diff --git a/src/sentry/preprod/tasks.py b/src/sentry/preprod/tasks.py index ae336db9fce410..207b2025f0f785 100644 --- a/src/sentry/preprod/tasks.py +++ b/src/sentry/preprod/tasks.py @@ -4,7 +4,7 @@ import logging import uuid from collections.abc import Callable -from typing import Any +from typing import Any, Dict import sentry_sdk from django.db import router, transaction @@ -54,6 +54,18 @@ logger = logging.getLogger(__name__) +from sentry.taskworker.registry import TaskRegistry + +# Separate registry for launchpad tasks +launchpad_registry = TaskRegistry(application="launchpad") +launchpad_namespace = launchpad_registry.create_namespace(name="default") + + +@launchpad_namespace.register(name="process_something") +def process_something(data: dict[Any, Any]) -> None: + """Stub - actual implementation in launchpad service""" + pass # This never runs; it's just for triggering + @instrumented_task( name="sentry.preprod.tasks.assemble_preprod_artifact", @@ -73,6 +85,8 @@ def assemble_preprod_artifact( """ Creates a preprod artifact from uploaded chunks. """ + print("starting assemble_preprod_artifact") + logger.info( "Starting preprod artifact assembly", extra={ @@ -201,6 +215,9 @@ def assemble_preprod_artifact( artifact_id=artifact_id, requested_features=requested_features, ) + + print("> APPLYING ASYNC process_something...") + process_something.apply_async() except Exception as e: user_friendly_error_message = "Failed to dispatch preprod artifact event for analysis" sentry_sdk.capture_exception(e) diff --git a/src/sentry/taskworker/registry.py b/src/sentry/taskworker/registry.py index 2bc8b37e3f6872..47b08f6fb3a547 100644 --- a/src/sentry/taskworker/registry.py +++ b/src/sentry/taskworker/registry.py @@ -156,6 +156,8 @@ def _handle_produce_future(self, future: ProducerFuture, tags: dict[str, str]) - def send_task(self, activation: TaskActivation, wait_for_delivery: bool = False) -> None: topic = self.router.route_namespace(self.name) + print(f"> SENDING {activation.taskname} TO TOPIC {topic}...") + with sentry_sdk.start_span( op=OP.QUEUE_PUBLISH, name=activation.taskname, diff --git a/src/sentry/taskworker/task.py b/src/sentry/taskworker/task.py index c89ef2b0fdb1d2..115dffc093dba3 100644 --- a/src/sentry/taskworker/task.py +++ b/src/sentry/taskworker/task.py @@ -124,6 +124,9 @@ def apply_async( activation = self.create_activation( args=args, kwargs=kwargs, headers=headers, expires=expires, countdown=countdown ) + + print(f"> CREATED ACTIVATION {activation.taskname} (application {activation.application})") + if settings.TASKWORKER_ALWAYS_EAGER: self._func(*args, **kwargs) else: diff --git a/src/sentry/taskworker/worker.py b/src/sentry/taskworker/worker.py index 87c1b9ce9584a2..80f2a067de1c5d 100644 --- a/src/sentry/taskworker/worker.py +++ b/src/sentry/taskworker/worker.py @@ -192,6 +192,7 @@ def _add_task(self) -> bool: inflight = self.fetch_task() if inflight: + print(f"> GOT TASK {inflight.activation.taskname}") try: start_time = time.monotonic() self._child_tasks.put(inflight) diff --git a/src/sentry/taskworker/workerchild.py b/src/sentry/taskworker/workerchild.py index ec72c7a9834905..287f0b6c1079e2 100644 --- a/src/sentry/taskworker/workerchild.py +++ b/src/sentry/taskworker/workerchild.py @@ -382,6 +382,7 @@ def _execute_activation(task_func: Task[Any, Any], activation: TaskActivation) - if "__start_time" in kwargs: kwargs.pop("__start_time") + print(f"> EXECUTING TASK {activation.namespace}:{activation.taskname}") try: task_func(*args, **kwargs) transaction.set_status(SPANSTATUS.OK) diff --git a/uv.lock b/uv.lock index e5dcb973eb2ae4..aa764e6d07ae04 100644 --- a/uv.lock +++ b/uv.lock @@ -2245,7 +2245,7 @@ dev = [ { name = "pyupgrade", specifier = ">=3.19.1" }, { name = "responses", specifier = ">=0.23.1" }, { name = "selenium", specifier = ">=4.16.0" }, - { name = "sentry-cli", specifier = ">=2.16.0" }, + { name = "sentry-cli", specifier = ">=3.1.0" }, { name = "sentry-covdefaults-disable-branch-coverage", specifier = ">=1.0.2" }, { name = "sentry-devenv", specifier = ">=1.22.0" }, { name = "sentry-forked-django-stubs", specifier = ">=5.2.2.post2" }, @@ -2284,13 +2284,12 @@ wheels = [ [[package]] name = "sentry-cli" -version = "2.16.0" +version = "3.1.0" source = { registry = "https://pypi.devinfra.sentry.io/simple" } wheels = [ - { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-2.16.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:db01ed6951a6f65faaf97b34f8dbe66c42c59f922f8be0f383f032309a4dd0b6" }, - { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-2.16.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:c2f51b3b79113ec4080908af7a0a8a43a3bf30873a801ed8f095ba5cf7b73e9e" }, - { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-2.16.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl", hash = "sha256:872462805c749cc974ba27709052194f080ff44762a47b98d7f520e34e64a260" }, - { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-2.16.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl", hash = "sha256:9d0541a3cbe96697f354549f2464c24c3250aa189e58d690ca632f434c34e6e8" }, + { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-3.1.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:1d8764eecf9ea7b6b5362bb81a297d7419de0618cc0305061a3ac80ab0df6e48" }, + { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-3.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_2_aarch64.whl", hash = "sha256:7f82d14ad5774e7586c2ec6345f02464c501c3ca04136ecfea73ca6d1e38f61f" }, + { url = "https://pypi.devinfra.sentry.io/wheels/sentry_cli-3.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.musllinux_1_2_x86_64.whl", hash = "sha256:8dbd75494ed846f327eadac437143a1d5216a7f86668859d8e5b8157ae06f5ee" }, ] [[package]] From 185ef049c05b57f1c4ed15fae4395afc6836469c Mon Sep 17 00:00:00 2001 From: james-mcnulty Date: Mon, 2 Feb 2026 12:02:27 -0800 Subject: [PATCH 2/3] Give Launchpad Artifact Processing Task Actual Args. --- src/sentry/preprod/tasks.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/sentry/preprod/tasks.py b/src/sentry/preprod/tasks.py index 207b2025f0f785..a3432fb0c528e6 100644 --- a/src/sentry/preprod/tasks.py +++ b/src/sentry/preprod/tasks.py @@ -4,7 +4,7 @@ import logging import uuid from collections.abc import Callable -from typing import Any, Dict +from typing import Any import sentry_sdk from django.db import router, transaction @@ -26,7 +26,7 @@ PreprodArtifactSizeMetrics, PreprodBuildConfiguration, ) -from sentry.preprod.producer import PreprodFeature, produce_preprod_artifact_to_kafka +from sentry.preprod.producer import PreprodFeature from sentry.preprod.quotas import ( has_installable_quota, has_size_quota, @@ -62,9 +62,9 @@ @launchpad_namespace.register(name="process_something") -def process_something(data: dict[Any, Any]) -> None: - """Stub - actual implementation in launchpad service""" - pass # This never runs; it's just for triggering +def process_artifact(*args: list[Any], **kwargs: dict[str, Any]) -> None: + """Stub - actual implementation in Launchpad service""" + pass @instrumented_task( @@ -85,8 +85,6 @@ def assemble_preprod_artifact( """ Creates a preprod artifact from uploaded chunks. """ - print("starting assemble_preprod_artifact") - logger.info( "Starting preprod artifact assembly", extra={ @@ -209,15 +207,16 @@ def assemble_preprod_artifact( if run_distribution: requested_features.append(PreprodFeature.BUILD_DISTRIBUTION) - produce_preprod_artifact_to_kafka( - project_id=project_id, - organization_id=org_id, - artifact_id=artifact_id, - requested_features=requested_features, - ) - print("> APPLYING ASYNC process_something...") - process_something.apply_async() + + process_artifact.apply_async( + kwargs={ + "artifact_id": str(artifact_id), + "project_id": str(project_id), + "organization_id": str(org_id), + "requested_features": [feature.value for feature in requested_features], + } + ) except Exception as e: user_friendly_error_message = "Failed to dispatch preprod artifact event for analysis" sentry_sdk.capture_exception(e) From 2b69f04a906c1bbd82309af12d89a1d3869cbf49 Mon Sep 17 00:00:00 2001 From: james-mcnulty Date: Mon, 2 Feb 2026 13:58:44 -0800 Subject: [PATCH 3/3] Fix Artifact Processing Task Stub Name --- src/sentry/preprod/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sentry/preprod/tasks.py b/src/sentry/preprod/tasks.py index a3432fb0c528e6..fe2be24d2757ab 100644 --- a/src/sentry/preprod/tasks.py +++ b/src/sentry/preprod/tasks.py @@ -61,7 +61,7 @@ launchpad_namespace = launchpad_registry.create_namespace(name="default") -@launchpad_namespace.register(name="process_something") +@launchpad_namespace.register(name="process_artifact") def process_artifact(*args: list[Any], **kwargs: dict[str, Any]) -> None: """Stub - actual implementation in Launchpad service""" pass @@ -207,7 +207,7 @@ def assemble_preprod_artifact( if run_distribution: requested_features.append(PreprodFeature.BUILD_DISTRIBUTION) - print("> APPLYING ASYNC process_something...") + print("> APPLYING ASYNC process_...") process_artifact.apply_async( kwargs={