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..fe2be24d2757ab 100644 --- a/src/sentry/preprod/tasks.py +++ b/src/sentry/preprod/tasks.py @@ -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, @@ -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_artifact") +def process_artifact(*args: list[Any], **kwargs: dict[str, Any]) -> None: + """Stub - actual implementation in Launchpad service""" + pass + @instrumented_task( name="sentry.preprod.tasks.assemble_preprod_artifact", @@ -195,11 +207,15 @@ 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_...") + + 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" 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]]