summaryrefslogtreecommitdiff
path: root/src/apscheduler/_context.py
blob: 5edc31055c58268cb6df4ef49eede1846136c13f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import annotations

from contextvars import ContextVar
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from ._structures import JobInfo
    from .schedulers.async_ import AsyncScheduler
    from .schedulers.sync import Scheduler

#: The currently running (local) scheduler
current_scheduler: ContextVar[Scheduler | None] = ContextVar(
    "current_scheduler", default=None
)
current_async_scheduler: ContextVar[AsyncScheduler | None] = ContextVar(
    "current_async_scheduler", default=None
)
#: Metadata about the current job
current_job: ContextVar[JobInfo] = ContextVar("job_info")