: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
fix(error-tracking): shard symbol set cleanup workers (#90276)
Hugues Pouillotac018a0d5bf5
diff --git a/products/error_tracking/backend/temporal/symbol_set_cleanup/activities.py b/products/error_tracking/backend/temporal/symbol_set_cleanup/activities.pyindex 4f758a9be0fe..19ce9fd677db 100644--- a/products/error_tracking/backend/temporal/symbol_set_cleanup/activities.py+++ b/products/error_tracking/backend/temporal/symbol_set_cleanup/activities.py@@ -1,9 +1,12 @@import timeimport datetimefrom itertools import batched+from uuid import UUID-from django.db import close_old_connections, transaction-from django.db.models import Q+from django.conf import settings+from django.db import DEFAULT_DB_ALIAS, close_old_connections, models, transaction+from django.db.models import F, Q+from django.db.models.lookups import GreaterThanfrom django.utils import timezoneimport structlog@@ -13,8 +16,10 @@ from products.error_tracking.backend.models import (ErrorTrackingStackFrame,ErrorTrackingSymbolSet,delete_symbol_set_contents_many,+ symbol_set_cleanup_bucket_expression,)from products.error_tracking.backend.temporal.symbol_set_cleanup.types import (+ SYMBOL_SET_CLEANUP_BUCKET_COUNT,SymbolSetCleanupInputs,SymbolSetCleanupResult,)@@ -25,19 +30,81 @@ _DELETE_REQUEST_BATCH_SIZE = 1000_DELETE_REQUEST_PACING_SECONDS = 0.1-def _cleanup_filter(inputs: SymbolSetCleanupInputs) -> Q:+def _cleanup_read_database() -> str:+ return "replica" if "replica" in settings.DATABASES else DEFAULT_DB_ALIAS+++def _cleanup_branches(inputs: SymbolSetCleanupInputs) -> list[Q]:cutoff_date = timezone.now() - datetime.timedelta(days=inputs.days_old)- query_filter = Q(last_used__isnull=False) & Q(last_used__lt=cutoff_date)+ query_branches = [Q(last_used__isnull=False, last_used__lt=cutoff_date)]if inputs.delete_unused:- query_filter = query_filter | (Q(last_used__isnull=True) & Q(created_at__lt=cutoff_date))+ query_branches.append(Q(last_used__isnull=True, created_at__lt=cutoff_date))+ return query_branches+++def _cleanup_filter(inputs: SymbolSetCleanupInputs) -> Q:+ query_filters = _cleanup_branches(inputs)+ query_filter = query_filters[0]+ for additional_filter in query_filters[1:]:+ query_filter |= additional_filterreturn query_filter+def _row(*expressions: F | models.Expression) -> models.Func:+ return models.Func(*expressions, function="", template="(%(expressions)s)", output_field=models.Field())+++def _after_cursor(cursor: tuple[datetime.datetime | None, datetime.datetime, UUID]) -> GreaterThan:+ last_used, created_at, symbol_set_id = cursor+ if last_used is None:+ return GreaterThan(+ _row(F("created_at"), F("id")),+ _row(models.Value(created_at), models.Value(symbol_set_id)),+ )+ return GreaterThan(+ _row(F("last_used"), F("created_at"), F("id")),+ _row(models.Value(last_used), models.Value(created_at), models.Value(symbol_set_id)),+ )+++def _cleanup_queryset(+ *,+ query_filter: Q,+ bucket: int,+ cursor: tuple[datetime.datetime | None, datetime.datetime, UUID] | None,+) -> models.QuerySet[ErrorTrackingSymbolSet]:+ queryset = (+ ErrorTrackingSymbolSet.objects.using(_cleanup_read_database())+ .alias(cleanup_bucket=symbol_set_cleanup_bucket_expression())+ .filter(query_filter, cleanup_bucket=bucket)+ )+ if cursor is not None:+ queryset = queryset.filter(_after_cursor(cursor))++ return queryset.order_by(+ "cleanup_bucket",+ F("last_used").asc(nulls_last=True),+ "created_at",+ "id",+ )+++def _assigned_buckets(inputs: SymbolSetCleanupInputs) -> list[int]:+ worker_count = max(1, min(inputs.bucket_worker_count, SYMBOL_SET_CLEANUP_BUCKET_COUNT))+ worker_index = inputs.bucket_worker_index % worker_count+ return [+ (inputs.bucket_offset + bucket) % SYMBOL_SET_CLEANUP_BUCKET_COUNT+ for bucket in range(worker_index, SYMBOL_SET_CLEANUP_BUCKET_COUNT, worker_count)+ ]++def _delete_symbol_set_batch(symbol_set_ids: list[str]) -> tuple[int, set[str]]:try:- with transaction.atomic():- ErrorTrackingStackFrame.objects.filter(symbol_set_id__in=symbol_set_ids, resolved=False).delete()- ErrorTrackingSymbolSet.objects.filter(id__in=symbol_set_ids).delete()+ with transaction.atomic(using=DEFAULT_DB_ALIAS):+ ErrorTrackingStackFrame.objects.using(DEFAULT_DB_ALIAS).filter(+ symbol_set_id__in=symbol_set_ids, resolved=False+ ).delete()+ ErrorTrackingSymbolSet.objects.using(DEFAULT_DB_ALIAS).filter(id__in=symbol_set_ids).delete()return len(symbol_set_ids), set()except Exception as exc:if len(symbol_set_ids) == 1:@@ -71,10 +138,11 @@ def cleanup_symbol_sets_activity(inputs: SymbolSetCleanupInputs) -> SymbolSetClequery_filter = _cleanup_filter(inputs)if inputs.dry_run:- eligible_count = ErrorTrackingSymbolSet.objects.filter(query_filter).count()+ eligible_symbol_sets = ErrorTrackingSymbolSet.objects.using(_cleanup_read_database()).filter(query_filter)+ eligible_count = eligible_symbol_sets.count()# Dry runs only log a bounded sample; never log more rows than the real run would process.sample_size = min(inputs.batch_size, inputs.total_per_run, eligible_count)- for symbol_set in ErrorTrackingSymbolSet.objects.filter(query_filter)[:sample_size]:+ for symbol_set in eligible_symbol_sets[:sample_size]:logger.info("error_tracking.symbol_set_cleanup.dry_run_candidate",symbol_set_id=str(symbol_set.id),@@ -98,61 +166,73 @@ def cleanup_symbol_sets_activity(inputs: SymbolSetCleanupInputs) -> SymbolSetCletotal_deleted = 0total_db_failed = 0total_storage_failed = 0- failed_ids: set[str] = set()-- while total_processed < inputs.total_per_run:- remaining = inputs.total_per_run - total_processed- chunk_size = min(inputs.batch_size, remaining)- with transaction.atomic():- symbol_sets = list(- ErrorTrackingSymbolSet.objects.select_for_update(skip_locked=True)- .filter(query_filter)- .exclude(id__in=failed_ids)- .order_by("last_used", "created_at")- .values_list("id", "storage_ptr")[:chunk_size]- )-- if not symbol_sets:- break-- symbol_set_ids = [str(symbol_set_id) for symbol_set_id, _ in symbol_sets]- storage_ptrs_by_id = {str(symbol_set_id): storage_ptr for symbol_set_id, storage_ptr in symbol_sets}- deleted_count, batch_failed_ids = _delete_symbol_set_batch(symbol_set_ids)-- total_deleted += deleted_count- total_db_failed += len(batch_failed_ids)- failed_ids.update(batch_failed_ids)-- deleted_storage_ptrs = [- storage_ptr- for symbol_set_id, storage_ptr in storage_ptrs_by_id.items()- if storage_ptr and symbol_set_id not in batch_failed_ids- ]- if deleted_storage_ptrs:- try:- failed_storage_ptrs = _delete_symbol_set_contents_with_pacing(deleted_storage_ptrs)- except Exception as exc:- failed_storage_ptrs = deleted_storage_ptrs- logger.exception(- "error_tracking.symbol_set_cleanup.s3_batch_delete_failed",- storage_objects_failed=len(failed_storage_ptrs),- error=str(exc),+ cleanup_branches = _cleanup_branches(inputs)++ for bucket in _assigned_buckets(inputs):+ for query_filter in cleanup_branches:+ cursor: tuple[datetime.datetime | None, datetime.datetime, UUID] | None = None+ while total_processed < inputs.total_per_run:+ remaining = inputs.total_per_run - total_processed+ chunk_size = min(inputs.batch_size, remaining)+ queryset = _cleanup_queryset(+ query_filter=query_filter,+ bucket=bucket,+ cursor=cursor,)- if failed_storage_ptrs:- total_storage_failed += len(failed_storage_ptrs)- logger.warning(- "error_tracking.symbol_set_cleanup.s3_delete_failures",- storage_objects_failed=len(failed_storage_ptrs),+ symbol_sets = list(queryset.values_list("id", "storage_ptr", "last_used", "created_at")[:chunk_size])++ if not symbol_sets:+ break++ cursor = (symbol_sets[-1][2], symbol_sets[-1][3], symbol_sets[-1][0])+ symbol_set_ids = [str(symbol_set_id) for symbol_set_id, _, _, _ in symbol_sets]+ storage_ptrs_by_id = {+ str(symbol_set_id): storage_ptr for symbol_set_id, storage_ptr, _, _ in symbol_sets+ }+ deleted_count, batch_failed_ids = _delete_symbol_set_batch(symbol_set_ids)++ total_deleted += deleted_count+ total_db_failed += len(batch_failed_ids)++ deleted_storage_ptrs = [+ storage_ptr+ for symbol_set_id, storage_ptr in storage_ptrs_by_id.items()+ if storage_ptr and symbol_set_id not in batch_failed_ids+ ]+ if deleted_storage_ptrs:+ try:+ failed_storage_ptrs = _delete_symbol_set_contents_with_pacing(deleted_storage_ptrs)+ except Exception as exc:+ failed_storage_ptrs = deleted_storage_ptrs+ logger.exception(+ "error_tracking.symbol_set_cleanup.s3_batch_delete_failed",+ storage_objects_failed=len(failed_storage_ptrs),+ error=str(exc),+ )+ if failed_storage_ptrs:+ total_storage_failed += len(failed_storage_ptrs)+ logger.warning(+ "error_tracking.symbol_set_cleanup.s3_delete_failures",+ storage_objects_failed=len(failed_storage_ptrs),+ )++ total_processed += len(symbol_sets)+ logger.info(+ "error_tracking.symbol_set_cleanup.progress",+ cleanup_bucket=bucket,+ objects_processed=total_processed,+ objects_deleted=total_deleted,+ objects_failed=total_db_failed,+ storage_objects_failed=total_storage_failed,)- total_processed += len(symbol_sets)- logger.info(- "error_tracking.symbol_set_cleanup.progress",- objects_processed=total_processed,- objects_deleted=total_deleted,- objects_failed=total_db_failed,- storage_objects_failed=total_storage_failed,- )+ if len(symbol_sets) < chunk_size:+ break++ if total_processed >= inputs.total_per_run:+ break+ if total_processed >= inputs.total_per_run:+ breakif total_db_failed > 0 or total_storage_failed > 0:logger.warning(diff --git a/products/error_tracking/backend/temporal/symbol_set_cleanup/test/test_symbol_set_cleanup.py b/products/error_tracking/backend/temporal/symbol_set_cleanup/test/test_symbol_set_cleanup.pyindex f07257f588d7..67e9151ad307 100644--- a/products/error_tracking/backend/temporal/symbol_set_cleanup/test/test_symbol_set_cleanup.py+++ b/products/error_tracking/backend/temporal/symbol_set_cleanup/test/test_symbol_set_cleanup.py@@ -7,6 +7,9 @@ from freezegun import freeze_timefrom posthog.test.base import BaseTestfrom unittest.mock import AsyncMock, call, patch+from django.conf import settings+from django.db import connection+from django.db.models import Qfrom django.utils import timezonefrom temporalio import activity@@ -15,10 +18,13 @@ from temporalio.worker import UnsandboxedWorkflowRunner, Workerfrom products.error_tracking.backend.models import ErrorTrackingStackFrame, ErrorTrackingSymbolSetfrom products.error_tracking.backend.temporal.symbol_set_cleanup.activities import (+ _assigned_buckets,+ _cleanup_queryset,_delete_symbol_set_contents_with_pacing,cleanup_symbol_sets_activity,)from products.error_tracking.backend.temporal.symbol_set_cleanup.types import (+ SYMBOL_SET_CLEANUP_BUCKET_COUNT,SymbolSetCleanupInputs,SymbolSetCleanupResult,)@@ -38,6 +44,23 @@ class TestDeleteSymbolSetContentsWithPacing:sleep.assert_called_once_with(0.1)+class TestSymbolSetCleanupBuckets:+ def test_workers_cover_every_bucket_once(self) -> None:+ assigned_buckets = [+ bucket+ for worker_index in range(4)+ for bucket in _assigned_buckets(+ SymbolSetCleanupInputs(+ bucket_worker_index=worker_index,+ bucket_worker_count=4,+ bucket_offset=73,+ )+ )+ ]++ assert sorted(assigned_buckets) == list(range(SYMBOL_SET_CLEANUP_BUCKET_COUNT))++class TestSymbolSetCleanupActivity(BaseTest):def _create_symbol_set(self,@@ -46,8 +69,11 @@ class TestSymbolSetCleanupActivity(BaseTest):created_at_days_ago: int,last_used_days_ago: int | None,storage_ptr: str | None = None,+ symbol_set_id: uuid.UUID | None = None,) -> ErrorTrackingSymbolSet:+ create_kwargs = {"id": symbol_set_id} if symbol_set_id is not None else {}symbol_set = ErrorTrackingSymbolSet.objects.create(+ **create_kwargs,team=self.team,ref=ref,storage_ptr=storage_ptr,@@ -107,7 +133,6 @@ class TestSymbolSetCleanupActivity(BaseTest):"symbols/old-used","symbols/old-unused",}- assert delete_contents.call_count == 1def test_delete_unused_false_only_deletes_old_used_symbol_sets(self) -> None:self._create_symbol_set("old-used", created_at_days_ago=45, last_used_days_ago=31)@@ -157,8 +182,21 @@ class TestSymbolSetCleanupActivity(BaseTest):assert ErrorTrackingSymbolSet.objects.count() == 2def test_respects_total_per_run(self) -> None:- for index in range(3):- self._create_symbol_set(f"old-used-{index}", created_at_days_ago=45, last_used_days_ago=31)+ symbol_sets = [+ self._create_symbol_set(+ f"old-used-{index}",+ created_at_days_ago=45,+ last_used_days_ago=31,+ symbol_set_id=uuid.UUID(int=(index + 1) * 256),+ )+ for index in range(3)+ ]+ shared_created_at = timezone.now() - timedelta(days=45)+ shared_last_used = timezone.now() - timedelta(days=31)+ ErrorTrackingSymbolSet.objects.filter(id__in=[symbol_set.id for symbol_set in symbol_sets]).update(+ created_at=shared_created_at,+ last_used=shared_last_used,+ )with patch("products.error_tracking.backend.temporal.symbol_set_cleanup.activities.close_old_connections"):result = cleanup_symbol_sets_activity(SymbolSetCleanupInputs(total_per_run=2, batch_size=1))@@ -166,6 +204,76 @@ class TestSymbolSetCleanupActivity(BaseTest):assert result == SymbolSetCleanupResult(objects_processed=2, objects_deleted=2, objects_failed=0)assert ErrorTrackingSymbolSet.objects.count() == 1+ def test_candidate_query_uses_replica_without_row_locks(self) -> None:+ with patch.dict(settings.DATABASES, {"replica": settings.DATABASES["default"]}):+ queryset = _cleanup_queryset(+ query_filter=Q(last_used__isnull=False, last_used__lt=timezone.now() - timedelta(days=30)),+ bucket=0,+ cursor=None,+ )++ assert queryset.db == "replica"+ assert not queryset.query.select_for_update++ def test_used_cursor_is_an_ordered_bucket_index_range(self) -> None:+ cursor = (+ timezone.now() - timedelta(days=45),+ timezone.now() - timedelta(days=50),+ uuid.UUID(int=1),+ )+ queryset = _cleanup_queryset(+ query_filter=Q(last_used__isnull=False, last_used__lt=timezone.now() - timedelta(days=30)),+ bucket=0,+ cursor=cursor,+ )++ with connection.cursor() as db_cursor:+ db_cursor.execute("SET LOCAL enable_seqscan = off")+ plan = queryset[:1].explain()++ assert "Index Scan using et_symset_bucket_cleanup_idx" in plan+ assert "Sort" not in plan+ assert "ROW(last_used, created_at, id) > ROW" in plan++ def test_unused_cursor_is_an_ordered_bucket_index_range(self) -> None:+ cursor = (None, timezone.now() - timedelta(days=45), uuid.UUID(int=1))+ queryset = _cleanup_queryset(+ query_filter=Q(last_used__isnull=True, created_at__lt=timezone.now() - timedelta(days=30)),+ bucket=0,+ cursor=cursor,+ )++ with connection.cursor() as db_cursor:+ db_cursor.execute("SET LOCAL enable_seqscan = off")+ plan = queryset[:1].explain()++ assert "Index Scan using et_symset_bucket_cleanup_idx" in plan+ assert "Sort" not in plan+ assert "ROW(created_at, id) > ROW" in plan++ def test_only_processes_buckets_assigned_to_the_worker(self) -> None:+ assigned = self._create_symbol_set(+ "assigned",+ created_at_days_ago=45,+ last_used_days_ago=31,+ symbol_set_id=uuid.UUID(int=2),+ )+ unassigned = self._create_symbol_set(+ "unassigned",+ created_at_days_ago=45,+ last_used_days_ago=31,+ symbol_set_id=uuid.UUID(int=3),+ )++ with patch("products.error_tracking.backend.temporal.symbol_set_cleanup.activities.close_old_connections"):+ result = cleanup_symbol_sets_activity(+ SymbolSetCleanupInputs(total_per_run=256, bucket_worker_index=0, bucket_worker_count=2)+ )++ assert result == SymbolSetCleanupResult(objects_processed=1, objects_deleted=1, objects_failed=0)+ assert not ErrorTrackingSymbolSet.objects.filter(id=assigned.id).exists()+ assert ErrorTrackingSymbolSet.objects.filter(id=unassigned.id).exists()+async def _run_workflow_with_mock_activity(inputs: SymbolSetCleanupInputs | None,@@ -207,10 +315,13 @@ class TestSymbolSetCleanupWorkflow:batch_size=10000,parallelism=4,dry_run=False,+ bucket_worker_index=0,+ bucket_worker_count=1,+ bucket_offset=0,)@pytest.mark.asyncio- async def test_workflow_splits_total_limit_across_parallel_activities(self) -> None:+ async def test_workflow_assigns_disjoint_buckets_to_parallel_activities(self) -> None:inputs = SymbolSetCleanupInputs(total_per_run=10, batch_size=5, parallelism=3)result, activity_inputs = await _run_workflow_with_mock_activity(@@ -226,6 +337,11 @@ class TestSymbolSetCleanupWorkflow:assert sorted(activity_input.total_per_run for activity_input in activity_inputs) == [3, 3, 4]assert all(activity_input.batch_size == 5 for activity_input in activity_inputs)assert all(activity_input.parallelism == 1 for activity_input in activity_inputs)+ assert sorted(+ (activity_input.bucket_worker_index, activity_input.bucket_worker_count)+ for activity_input in activity_inputs+ ) == [(0, 3), (1, 3), (2, 3)]+ assert len({activity_input.bucket_offset for activity_input in activity_inputs}) == 1@pytest.mark.asyncioasync def test_workflow_runs_dry_run_once(self) -> None:diff --git a/products/error_tracking/backend/temporal/symbol_set_cleanup/types.py b/products/error_tracking/backend/temporal/symbol_set_cleanup/types.pyindex 66a73a7a8144..2611dddb39b0 100644--- a/products/error_tracking/backend/temporal/symbol_set_cleanup/types.py+++ b/products/error_tracking/backend/temporal/symbol_set_cleanup/types.py@@ -1,5 +1,7 @@import dataclasses+SYMBOL_SET_CLEANUP_BUCKET_COUNT = 256+@dataclasses.dataclass(frozen=True)class SymbolSetCleanupInputs:@@ -7,11 +9,12 @@ class SymbolSetCleanupInputs:delete_unused: bool = Truetotal_per_run: int = 1000000batch_size: int = 10000- # Workers contend rather than divide: they take `FOR UPDATE SKIP LOCKED` over the same- # ordered range, so each one pays the full traversal and skips what the others hold.- # `total_per_run` caps throughput regardless, so fewer workers spend less to reach it.+ # Runtime workers divide the fixed indexed buckets, so parallelism can change without rebuilding the index.parallelism: int = 4dry_run: bool = False+ bucket_worker_index: int = 0+ bucket_worker_count: int = 1+ bucket_offset: int = 0@dataclasses.dataclass(frozen=True)diff --git a/products/error_tracking/backend/temporal/symbol_set_cleanup/workflow.py b/products/error_tracking/backend/temporal/symbol_set_cleanup/workflow.pyindex 5ae2fcda987a..fe9627566650 100644--- a/products/error_tracking/backend/temporal/symbol_set_cleanup/workflow.py+++ b/products/error_tracking/backend/temporal/symbol_set_cleanup/workflow.py@@ -9,18 +9,21 @@ from posthog.temporal.common.base import PostHogWorkflowwith workflow.unsafe.imports_passed_through():from products.error_tracking.backend.temporal.symbol_set_cleanup.activities import cleanup_symbol_sets_activityfrom products.error_tracking.backend.temporal.symbol_set_cleanup.types import (+ SYMBOL_SET_CLEANUP_BUCKET_COUNT,SymbolSetCleanupInputs,SymbolSetCleanupResult,)WORKFLOW_NAME = "error-tracking-symbol-set-cleanup"PARALLEL_CLEANUP_PATCH_ID = "error-tracking-parallel-symbol-set-cleanup"+BUCKETED_CLEANUP_PATCH_ID = "error-tracking-bucketed-symbol-set-cleanup"ACTIVITY_RETRY_POLICY = common.RetryPolicy(maximum_attempts=1)ACTIVITY_START_TO_CLOSE_TIMEOUT = timedelta(hours=2)+BUCKET_ROTATION_INTERVAL = timedelta(minutes=30)-def _activity_inputs(inputs: SymbolSetCleanupInputs) -> list[SymbolSetCleanupInputs]:+def _legacy_activity_inputs(inputs: SymbolSetCleanupInputs) -> list[SymbolSetCleanupInputs]:if inputs.dry_run or inputs.total_per_run <= 0:return [inputs]@@ -39,6 +42,28 @@ def _activity_inputs(inputs: SymbolSetCleanupInputs) -> list[SymbolSetCleanupInp]+def _bucketed_activity_inputs(inputs: SymbolSetCleanupInputs, bucket_offset: int) -> list[SymbolSetCleanupInputs]:+ if inputs.dry_run or inputs.total_per_run <= 0:+ return [inputs]++ parallelism = max(1, min(inputs.parallelism, inputs.total_per_run))+ per_activity_limit, remainder = divmod(inputs.total_per_run, parallelism)+ return [+ SymbolSetCleanupInputs(+ days_old=inputs.days_old,+ delete_unused=inputs.delete_unused,+ total_per_run=per_activity_limit + (1 if index < remainder else 0),+ batch_size=inputs.batch_size,+ parallelism=1,+ dry_run=False,+ bucket_worker_index=index,+ bucket_worker_count=parallelism,+ bucket_offset=bucket_offset,+ )+ for index in range(parallelism)+ ]++def _combine_results(results: list[SymbolSetCleanupResult]) -> SymbolSetCleanupResult:eligible_counts = [result.eligible_count for result in results if result.eligible_count is not None]return SymbolSetCleanupResult(@@ -72,15 +97,24 @@ class ErrorTrackingSymbolSetCleanupWorkflow(PostHogWorkflow):retry_policy=ACTIVITY_RETRY_POLICY,)+ if workflow.patched(BUCKETED_CLEANUP_PATCH_ID):+ bucket_offset = (+ int(workflow.now().timestamp() / BUCKET_ROTATION_INTERVAL.total_seconds())+ % SYMBOL_SET_CLEANUP_BUCKET_COUNT+ )+ activity_inputs = _bucketed_activity_inputs(inputs, bucket_offset)+ else:+ activity_inputs = _legacy_activity_inputs(inputs)+results = await asyncio.gather(*[workflow.execute_activity(cleanup_symbol_sets_activity,- activity_inputs,+ activity_input,start_to_close_timeout=ACTIVITY_START_TO_CLOSE_TIMEOUT,retry_policy=ACTIVITY_RETRY_POLICY,)- for activity_inputs in _activity_inputs(inputs)+ for activity_input in activity_inputs])return _combine_results(results)