:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from products.autoresearch.backend.models import AutoresearchPipeline
def resolve_pipeline(pipeline_id: str) -> AutoresearchPipeline:
"""Look up a pipeline by id, before any team scope is known.
A CLI operator supplies a pipeline id, not a team, so this one read is
deliberately cross-team. Every caller enters the pipeline's team scope for
the work that follows.
"""
try:
return AutoresearchPipeline.objects.unscoped().select_related("team").get(pk=pipeline_id)
except AutoresearchPipeline.DoesNotExist:
raise CommandError(f"Pipeline {pipeline_id} not found.")
except (ValidationError, ValueError):
raise CommandError(f"Pipeline id {pipeline_id!r} is not a valid UUID.")