Skip to content
Draft
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
4 changes: 4 additions & 0 deletions .github/workflows/test-integrations-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ jobs:
- name: Setup Test Env
run: |
uv sync
- name: Test apscheduler
run: |
set -x # print commands that are executed
./scripts/runtox.sh "py${{ matrix.python-version }}-apscheduler"
- name: Test arq
run: |
set -x # print commands that are executed
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ ignore_missing_imports = true
module = "huey.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "apscheduler.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "openai.*"
ignore_missing_imports = true
Expand Down
5 changes: 5 additions & 0 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"python": ">=3.8",
"num_versions": 2,
},
"apscheduler": {
"package": "apscheduler",
# 4.x is a rewrite with a different API and isn't supported.
"include": "<4",
},
"arq": {
"package": "arq",
"deps": {
Expand Down
4 changes: 4 additions & 0 deletions scripts/populate_tox/package_dependencies.jsonl

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions scripts/populate_tox/releases.jsonl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/split_tox_gh_actions/split_tox_gh_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"requests",
],
"Tasks": [
"apscheduler",
"arq",
"beam",
"celery",
Expand Down
29 changes: 29 additions & 0 deletions sentry_sdk/crons/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Optional, Tuple

from sentry_sdk._types import MonitorConfigSchedule, MonitorConfigScheduleUnit


_INTERVAL_UNITS: "Tuple[Tuple[MonitorConfigScheduleUnit, int], ...]" = (
("day", 60 * 60 * 24),
("hour", 60 * 60),
("minute", 60),
)


def _get_interval_schedule(seconds: float) -> "Optional[MonitorConfigSchedule]":
"""
Express an interval in the largest unit that divides it evenly.

Returns None if the interval isn't a whole number of minutes.
"""
for unit, unit_seconds in _INTERVAL_UNITS:
if seconds >= unit_seconds and seconds % unit_seconds == 0:
return {
"type": "interval",
"value": int(seconds // unit_seconds),
"unit": unit,
}
return None
1 change: 1 addition & 0 deletions sentry_sdk/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def iter_default_integrations(
"aiohttp": (3, 4),
"aiomysql": (0, 3, 0),
"anthropic": (0, 16),
"apscheduler": (3, 3),
"ariadne": (0, 20),
"arq": (0, 23),
"asyncpg": (0, 23),
Expand Down
Loading
Loading