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
10 changes: 5 additions & 5 deletions src/sentry/integrations/github/tasks/codecov_account_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sentry.integrations.types import IntegrationProviderSlug
from sentry.organizations.services.organization import organization_service
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import (
integrations_control_tasks,
integrations_control_throttled_tasks,
Expand All @@ -22,11 +22,11 @@
@instrumented_task(
name="sentry.integrations.github.tasks.codecov_account_link",
namespace=integrations_control_tasks,
retry=Retry(times=3),
retry=Retry(times=3, on=(Exception,), ignore=(ConfigurationError,)),
processing_deadline_duration=60,
silo_mode=SiloMode.CONTROL,
silenced_exceptions=(ConfigurationError,),
)
@retry(exclude=(ConfigurationError,))
def codecov_account_link(
integration_id: int,
organization_id: int,
Expand All @@ -38,10 +38,10 @@ def codecov_account_link(
name="sentry.integrations.github.tasks.backfill_codecov_account_link",
silo_mode=SiloMode.CONTROL,
namespace=integrations_control_throttled_tasks,
retry=Retry(times=3),
retry=Retry(times=3, on=(Exception,), ignore=(ConfigurationError,)),
processing_deadline_duration=60,
silenced_exceptions=(ConfigurationError,),
)
@retry(exclude=(ConfigurationError,))
def backfill_codecov_account_link(
integration_id: int,
organization_id: int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sentry.constants import ObjectStatus
from sentry.integrations.services.integration import integration_service
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_control_tasks

logger = logging.getLogger(__name__)
Expand All @@ -17,11 +17,11 @@
@instrumented_task(
name="sentry.integrations.github.tasks.codecov_account_unlink",
namespace=integrations_control_tasks,
retry=Retry(times=3),
retry=Retry(times=3, on=(Exception,), ignore=(ConfigurationError,)),
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.

Seems a bit odd that the decorator needs to specify what to retry on ? Versus just saying what to ignore and then retry on everything else... Curious what was the why there?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The older decorator did the same thing, it just set a default of (Exception,). We've opted to make this more explicit now, since this makes it instantly clear what the Retry is and isn't doing, though I do see your point.

processing_deadline_duration=60,
silo_mode=SiloMode.CONTROL,
silenced_exceptions=(ConfigurationError,),
)
@retry(exclude=(ConfigurationError,))
def codecov_account_unlink(
integration_id: int,
organization_ids: list[int],
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/github/tasks/link_all_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from sentry.plugins.providers.integration_repository import get_integration_repository_provider
from sentry.shared_integrations.exceptions import ApiError
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_control_tasks

logger = logging.getLogger(__name__)
Expand All @@ -38,11 +38,11 @@ def get_repo_config(repo: Mapping[str, Any], integration_id: int) -> GitHubRepoI
@instrumented_task(
name="sentry.integrations.github.tasks.link_all_repos",
namespace=integrations_control_tasks,
retry=Retry(times=3),
retry=Retry(times=3, on=(Exception,), ignore=(KeyError,)),
processing_deadline_duration=60,
silo_mode=SiloMode.CONTROL,
silenced_exceptions=(KeyError,),
)
@retry(exclude=(KeyError,))
def link_all_repos(
integration_key: str,
integration_id: int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from sentry.organizations.services.organization.model import RpcOrganization
from sentry.plugins.providers.integration_repository import get_integration_repository_provider
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_control_tasks

from .link_all_repos import GitHubRepoInputConfig, get_repo_config
Expand All @@ -30,11 +30,11 @@
@instrumented_task(
name="sentry.integrations.github.tasks.sync_repos_on_install_change",
namespace=integrations_control_tasks,
retry=Retry(times=3, delay=120),
retry=Retry(times=3, delay=120, on=(Exception,), ignore=(KeyError,)),
processing_deadline_duration=120,
silo_mode=SiloMode.CONTROL,
silenced_exceptions=(KeyError,),
)
@retry(exclude=(KeyError,))
def sync_repos_on_install_change(
integration_id: int,
action: str,
Expand Down
10 changes: 5 additions & 5 deletions src/sentry/integrations/jira/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
from sentry.plugins.base import plugins
from sentry.shared_integrations.exceptions import IntegrationError
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_control_tasks, integrations_tasks


@instrumented_task(
name="sentry.integrations.jira.tasks.migrate_issues",
namespace=integrations_tasks,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(times=5, delay=60 * 5, on=(Exception,), ignore=(Integration.DoesNotExist,)),
silenced_exceptions=(Integration.DoesNotExist,),
)
@retry(exclude=(Integration.DoesNotExist))
def migrate_issues(integration_id: int, organization_id: int) -> None:
from sentry_plugins.jira.plugin import JiraPlugin

Expand Down Expand Up @@ -117,10 +117,10 @@ def migrate_issues(integration_id: int, organization_id: int) -> None:
@instrumented_task(
name="sentry.integrations.jira.tasks.sync_metadata",
namespace=integrations_control_tasks,
retry=Retry(times=5, delay=20),
retry=Retry(times=5, delay=20, on=(IntegrationError,), ignore=(Integration.DoesNotExist,)),
silo_mode=SiloMode.CONTROL,
silenced_exceptions=(Integration.DoesNotExist,),
)
@retry(on=(IntegrationError,), exclude=(Integration.DoesNotExist,))
def sync_metadata(integration_id: int) -> None:
from sentry.integrations.jira.integration import JiraIntegration
from sentry.integrations.jira_server.integration import JiraServerIntegration
Expand Down
11 changes: 8 additions & 3 deletions src/sentry/integrations/opsgenie/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sentry.integrations.services.integration.service import integration_service
from sentry.models.project import Project
from sentry.models.rule import Rule
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_tasks

ALERT_LEGACY_INTEGRATIONS = {"id": "sentry.rules.actions.notify_event.NotifyEventAction"}
Expand All @@ -24,9 +24,14 @@
@instrumented_task(
name="sentry.integrations.opsgenie.tasks.migrate_opsgenie_plugins",
namespace=integrations_tasks,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(
times=5,
delay=60 * 5,
on=(Exception,),
ignore=(Integration.DoesNotExist, OrganizationIntegration.DoesNotExist),
),
silenced_exceptions=(Integration.DoesNotExist, OrganizationIntegration.DoesNotExist),
)
@retry(exclude=(Integration.DoesNotExist, OrganizationIntegration.DoesNotExist))
def migrate_opsgenie_plugin(integration_id: int, organization_id: int) -> None:
with record_event(OnCallInteractionType.MIGRATE_PLUGIN).capture():
from sentry_plugins.opsgenie.plugin import OpsGeniePlugin
Expand Down
14 changes: 5 additions & 9 deletions src/sentry/integrations/source_code_management/sync_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
IntegrationError,
)
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_control_tasks
from sentry.utils import metrics
from sentry.utils.cursored_scheduler import CursoredScheduler
Expand Down Expand Up @@ -135,11 +135,10 @@ def _halt_broken_integration(
@instrumented_task(
name="sentry.integrations.source_code_management.sync_repos.sync_repos_for_org",
namespace=integrations_control_tasks,
retry=Retry(times=3, delay=120),
retry=Retry(times=3, delay=120, on=(Exception,)),
processing_deadline_duration=120,
silo_mode=SiloMode.CONTROL,
)
@retry()
def sync_repos_for_org(organization_integration_id: int) -> None:
"""
Sync repositories for a single OrganizationIntegration.
Expand Down Expand Up @@ -419,11 +418,10 @@ def _get_sync_context(
@instrumented_task(
name="sentry.integrations.source_code_management.sync_repos.create_repos_batch",
namespace=integrations_control_tasks,
retry=Retry(times=3, delay=120),
retry=Retry(times=3, delay=120, on=(Exception,)),
processing_deadline_duration=120,
silo_mode=SiloMode.CONTROL,
)
@retry()
def create_repos_batch(
organization_integration_id: int,
repo_configs: list[dict[str, object]],
Expand Down Expand Up @@ -460,11 +458,10 @@ def create_repos_batch(
@instrumented_task(
name="sentry.integrations.source_code_management.sync_repos.disable_repos_batch",
namespace=integrations_control_tasks,
retry=Retry(times=3, delay=120),
retry=Retry(times=3, delay=120, on=(Exception,)),
processing_deadline_duration=120,
silo_mode=SiloMode.CONTROL,
)
@retry()
def disable_repos_batch(
organization_integration_id: int,
external_ids: list[str],
Expand Down Expand Up @@ -507,11 +504,10 @@ def disable_repos_batch(
@instrumented_task(
name="sentry.integrations.source_code_management.sync_repos.restore_repos_batch",
namespace=integrations_control_tasks,
retry=Retry(times=3, delay=120),
retry=Retry(times=3, delay=120, on=(Exception,)),
processing_deadline_duration=120,
silo_mode=SiloMode.CONTROL,
)
@retry()
def restore_repos_batch(
organization_integration_id: int,
external_ids: list[str],
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/tasks/create_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
from sentry.models.activity import Activity
from sentry.shared_integrations.exceptions import IntegrationConfigurationError
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_tasks
from sentry.types.activity import ActivityType


@instrumented_task(
name="sentry.integrations.tasks.create_comment",
namespace=integrations_tasks,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(times=5, delay=60 * 5, on=(Exception,), ignore=(Integration.DoesNotExist,)),
silo_mode=SiloMode.CELL,
silenced_exceptions=(Integration.DoesNotExist,),
)
@retry(exclude=(Integration.DoesNotExist))
def create_comment(external_issue_id: int, user_id: int, group_note_id: int) -> None:
try:
external_issue = ExternalIssue.objects.get(id=external_issue_id)
Expand Down
5 changes: 2 additions & 3 deletions src/sentry/integrations/tasks/kick_off_status_syncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

from sentry.models.grouplink import GroupLink
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry, track_group_async_operation
from sentry.tasks.base import instrumented_task, track_group_async_operation
from sentry.taskworker.namespaces import integrations_tasks


@instrumented_task(
name="sentry.integrations.tasks.kick_off_status_syncs",
namespace=integrations_tasks,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(times=5, delay=60 * 5, on=(Exception,)),
silo_mode=SiloMode.CELL,
)
@retry()
@track_group_async_operation
def kick_off_status_syncs(project_id: int, group_id: int) -> None:
"""This is run async to avoid extra queries in the EventManager."""
Expand Down
15 changes: 12 additions & 3 deletions src/sentry/integrations/tasks/migrate_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,27 @@
from sentry.models.repository import Repository
from sentry.organizations.services.organization import organization_service
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_control_tasks


@instrumented_task(
name="sentry.integrations.tasks.migrate_repo",
namespace=integrations_control_tasks,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(
times=5,
delay=60 * 5,
on=(Exception,),
ignore=(Integration.DoesNotExist, Repository.DoesNotExist, Organization.DoesNotExist),
),
processing_deadline_duration=60,
silo_mode=SiloMode.CONTROL,
silenced_exceptions=(
Integration.DoesNotExist,
Repository.DoesNotExist,
Organization.DoesNotExist,
),
)
@retry(exclude=(Integration.DoesNotExist, Repository.DoesNotExist, Organization.DoesNotExist))
def migrate_repo(repo_id: int, integration_id: int, organization_id: int) -> None:
from sentry.plugins.migrator import Migrator

Expand Down
21 changes: 15 additions & 6 deletions src/sentry/integrations/tasks/sync_assignee_outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
IntegrationError,
)
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry
from sentry.tasks.base import instrumented_task
from sentry.taskworker.namespaces import integrations_tasks
from sentry.users.models.user import User
from sentry.users.services.user.service import user_service
Expand All @@ -31,17 +31,26 @@
name="sentry.integrations.tasks.sync_assignee_outbound",
namespace=integrations_tasks,
processing_deadline_duration=30,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(
times=5,
delay=60 * 5,
on=(Exception,),
ignore=(
ExternalIssue.DoesNotExist,
Integration.DoesNotExist,
User.DoesNotExist,
Organization.DoesNotExist,
IntegrationError,
),
),
silo_mode=SiloMode.CELL,
)
@retry(
exclude=(
silenced_exceptions=(
ExternalIssue.DoesNotExist,
Integration.DoesNotExist,
User.DoesNotExist,
Organization.DoesNotExist,
IntegrationError,
)
),
)
def sync_assignee_outbound(
external_issue_id: int,
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/tasks/sync_status_inbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from sentry.models.release import Release, ReleaseStatus, follows_semver_versioning_scheme
from sentry.signals import issue_resolved, issue_unresolved
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry, track_group_async_operation
from sentry.tasks.base import instrumented_task, track_group_async_operation
from sentry.taskworker.namespaces import integrations_tasks
from sentry.types.activity import ActivityType
from sentry.types.group import GroupSubStatus
Expand Down Expand Up @@ -193,10 +193,10 @@ def group_was_recently_resolved(group: Group) -> bool:
name="sentry.integrations.tasks.sync_status_inbound",
namespace=integrations_tasks,
processing_deadline_duration=150,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(times=5, delay=60 * 5, on=(Exception,), ignore=(Integration.DoesNotExist,)),
silo_mode=SiloMode.CELL,
silenced_exceptions=(Integration.DoesNotExist,),
)
@retry(exclude=(Integration.DoesNotExist,))
@track_group_async_operation
def sync_status_inbound(
integration_id: int, organization_id: int, issue_key: str, data: Mapping[str, Any]
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/integrations/tasks/sync_status_outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
from sentry.models.group import Group, GroupStatus
from sentry.shared_integrations.exceptions import ApiUnauthorized, IntegrationFormError
from sentry.silo.base import SiloMode
from sentry.tasks.base import instrumented_task, retry, track_group_async_operation
from sentry.tasks.base import instrumented_task, track_group_async_operation
from sentry.taskworker.namespaces import integrations_tasks


@instrumented_task(
name="sentry.integrations.tasks.sync_status_outbound",
namespace=integrations_tasks,
retry=Retry(times=5, delay=60 * 5),
retry=Retry(times=5, delay=60 * 5, on=(Exception,), ignore=(Integration.DoesNotExist,)),
silo_mode=SiloMode.CELL,
silenced_exceptions=(Integration.DoesNotExist,),
)
@retry(exclude=(Integration.DoesNotExist,))
@track_group_async_operation
def sync_status_outbound(group_id: int, external_issue_id: int) -> bool | None:
groups = Group.objects.filter(
Expand Down
Loading
Loading