Skip to content

: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.

chore(data-quality): key check schedules by subject (#102495)

Thiago Salvatore5291c740729f
diff --git a/docs/internal/data-quality-checks.md b/docs/internal/data-quality-checks.md
index c2db1aecaa0c..7554702ff583 100644
--- a/docs/internal/data-quality-checks.md
+++ b/docs/internal/data-quality-checks.md
@@ -48,15 +48,15 @@ Notification recipient checks retain the existing global warehouse-resource poli
Catalog access is a project permission resource. Notification visibility follows that permission, including after access is revoked.
-## Metric schedules
+## Subject schedules
-Each metric with checks has one Temporal Schedule in its canonical project. The first check creates an enabled daily schedule after the check transaction commits and starts an initial run. Available intervals are one hour, six hours, twelve hours, one day, and one week. A deterministic offset spreads recurring executions across each interval.
+A subject whose checks run on a recurring schedule has one Temporal Schedule in its canonical project. Metrics are the only such subject today; a table's and a view's checks run when their data changes instead. The first check creates an enabled daily schedule after the check transaction commits and starts an initial run. Available intervals are one hour, six hours, twelve hours, one day, and one week. A deterministic offset spreads recurring executions across each interval.
Temporal owns the interval, pause state, and next execution time. The schedule endpoint reads and updates Temporal directly. Paused schedules return `next_run_at: null`. An unavailable schedule service returns HTTP 503; reload the schedule before retrying an update whose outcome is unknown. Last scheduled run information comes from the caller's readable suite history. Manual runs do not change it.
Scheduled executions skip an occurrence when the previous scheduled workflow is still running. Temporal catches up missed occurrences within 15 minutes and does not pause a schedule after a failed run. Manual runs keep their existing behavior. A scheduled activity rechecks schedule existence and pause state before selecting current enabled checks. An executing check can finish after the schedule is paused. Feature flags, subject existence, and execution permissions are checked in activities.
-A reconciler runs every 15 minutes, processing bounded pages of checks and product-filtered Temporal schedules. It performs up to 10 independent repairs or deletions at a time within a page, then advances only after the whole page succeeds. It repairs missing schedules without changing existing intervals or pause states, and deletes schedules whose metrics no longer exist. Deleting or disabling all checks retains the metric's schedule preferences and executes no check queries. Deleted metrics stop producing check queries immediately, even if schedule cleanup needs a retry.
+A reconciler runs every 15 minutes, processing bounded pages of checks and product-filtered Temporal schedules. It performs up to 10 independent repairs or deletions at a time within a page, then advances only after the whole page succeeds. It repairs missing schedules without changing existing intervals or pause states, and deletes schedules whose subject no longer exists. Deleting or disabling all checks retains the metric's schedule preferences and executes no check queries. Deleted metrics stop producing check queries immediately, even if schedule cleanup needs a retry.
In the metric Tests tab, a failed schedule edit refreshes the persisted state and offers Reload before another edit. Schedule controls stay disabled while a request is pending or its outcome is uncertain.
diff --git a/products/data_quality/backend/activity_logging.py b/products/data_quality/backend/activity_logging.py
index 30820896ba0e..3d09fa089e22 100644
--- a/products/data_quality/backend/activity_logging.py
+++ b/products/data_quality/backend/activity_logging.py
@@ -14,7 +14,7 @@ from posthog.models.signals import model_activity_signal, mutable_receiver
from .models import DataQualityCheck
if TYPE_CHECKING:
- from .logic.schedules import MetricCheckSchedule
+ from .logic.schedules import CheckSchedule
@mutable_receiver(model_activity_signal, sender=DataQualityCheck)
@@ -38,11 +38,12 @@ def handle_data_quality_check_activity(
)
-def log_metric_schedule_change(
+def log_schedule_change(
team_id: int,
- metric_id: str,
- before: "MetricCheckSchedule",
- after: "MetricCheckSchedule",
+ subject_type: str,
+ subject_uuid: str,
+ before: "CheckSchedule",
+ after: "CheckSchedule",
user: User,
) -> None:
from .logic.subjects import resolve_subject # noqa: PLC0415 — avoids loading the catalog during Django startup
@@ -60,7 +61,7 @@ def log_metric_schedule_change(
]
if not changes:
return
- subject = resolve_subject(team_id, "metric", metric_id)
+ subject = resolve_subject(team_id, subject_type, subject_uuid)
log_activity(
organization_id=None,
team_id=team_id,
@@ -69,5 +70,5 @@ def log_metric_schedule_change(
item_id=str(after.id),
scope="DataQualityCheckSchedule",
activity="updated",
- detail=Detail(name=f"metric check schedule on {subject.name or metric_id}", changes=changes),
+ detail=Detail(name=f"{subject_type} check schedule on {subject.name or subject_uuid}", changes=changes),
)
diff --git a/products/data_quality/backend/facade/api.py b/products/data_quality/backend/facade/api.py
index 6920ad1cc775..da1ffc710b1c 100644
--- a/products/data_quality/backend/facade/api.py
+++ b/products/data_quality/backend/facade/api.py
@@ -7,7 +7,7 @@ the AST-bearing ``CheckPlan`` stay inside ``logic``, since they are compiler int
data. ORM model classes never cross here either -- ``facade/models.py`` is their one channel.
"""
-from ..activity_logging import log_metric_schedule_change
+from ..activity_logging import log_schedule_change
from ..logic.checks import (
checks_for_subject,
edit_check,
@@ -33,13 +33,7 @@ from ..logic.permissions import authorized_subject_types, restrict_subject_types
from ..logic.registry import UnknownCheckTypeError, list_check_types
from ..logic.run_records import record_check_run
from ..logic.schedule_service import get_schedule_with_history, schedule_with_history, update_schedule
-from ..logic.schedules import (
- MetricCheckSchedule,
- ScheduleUnavailableError,
- ScheduleUpdateResult,
- get_schedule,
- set_schedule,
-)
+from ..logic.schedules import CheckSchedule, ScheduleUnavailableError, ScheduleUpdateResult, get_schedule, set_schedule
from ..logic.serialization import compute_fingerprint, from_config_entry, to_config_entry
from ..logic.subject_access import (
DenialContext,
@@ -57,13 +51,14 @@ from ..logic.subject_access import (
visible_checks,
without_denied_runs,
)
+from ..logic.subject_schedules import runs_on_a_schedule
from ..logic.subjects import resolve_metric_subjects, resolve_subject, selectable_subjects, testable_metric_subjects
from ..logic.triggers import materialization_audit_mode as quality_audit_mode
from .contracts import CheckTypeInfo, MetricSubject, OutputColumn, SelectableSubject
__all__ = [
- "log_metric_schedule_change",
- "MetricCheckSchedule",
+ "log_schedule_change",
+ "CheckSchedule",
"ScheduleUnavailableError",
"ScheduleUpdateResult",
"CheckConfigError",
@@ -112,6 +107,7 @@ __all__ = [
"resolve_metric_subjects",
"roll_up_health",
"set_gate_materialization_on_checks",
+ "runs_on_a_schedule",
"set_schedule",
"schedule_with_history",
"soft_delete_check",
diff --git a/products/data_quality/backend/logic/checks.py b/products/data_quality/backend/logic/checks.py
index 679359f7e137..06308a74f8eb 100644
--- a/products/data_quality/backend/logic/checks.py
+++ b/products/data_quality/backend/logic/checks.py
@@ -39,7 +39,7 @@ from .errors import (
from .exceptions import CheckNameConflict
from .health import CheckStatusRow, roll_up_health
from .registry import get_spec
-from .schedules import provision_metric_schedule
+from .schedules import provision_schedule
from .serialization import compute_fingerprint
from .spec import CheckConfig
from .subjects import resolve_subject, subject_column_type
@@ -167,7 +167,9 @@ def upsert_check(
**fields,
)
if check.subject_type == SubjectType.METRIC and check.metric_id:
- transaction.on_commit(partial(provision_metric_schedule, check.team_id, str(check.metric_id)))
+ transaction.on_commit(
+ partial(provision_schedule, check.team_id, subject_type, str(check.subject_uuid))
+ )
return check, True
except IntegrityError:
# Check-then-insert race: a concurrent identical request inserted this fingerprint between
diff --git a/products/data_quality/backend/logic/schedule_service.py b/products/data_quality/backend/logic/schedule_service.py
index e6834c51c572..2a57272e3b96 100644
--- a/products/data_quality/backend/logic/schedule_service.py
+++ b/products/data_quality/backend/logic/schedule_service.py
@@ -4,10 +4,10 @@ from dataclasses import replace
from typing import TYPE_CHECKING
from uuid import UUID
-from ..activity_logging import log_metric_schedule_change
+from ..activity_logging import log_schedule_change
from ..facade.enums import SuiteRunTrigger
from ..models import DataQualitySuiteRun
-from .schedules import MetricCheckSchedule, get_schedule, update_schedule_with_snapshots
+from .schedules import CheckSchedule, get_schedule, update_schedule_with_snapshots
from .subject_access import suites_backing_unreadable_runs_q, unreadable_suites_q
if TYPE_CHECKING:
@@ -21,9 +21,9 @@ def schedule_with_history(
team_id: int,
subject_type: SubjectType,
subject_uuid: str | UUID,
- schedule: MetricCheckSchedule,
+ schedule: CheckSchedule,
authorization_context: DenialContext | None = None,
-) -> MetricCheckSchedule:
+) -> CheckSchedule:
suites = DataQualitySuiteRun.objects.for_team(team_id).filter(
subject_type=subject_type,
subject_uuid=subject_uuid,
@@ -44,7 +44,7 @@ def get_schedule_with_history(
subject_type: SubjectType,
subject_uuid: str | UUID,
authorization_context: DenialContext | None = None,
-) -> MetricCheckSchedule | None:
+) -> CheckSchedule | None:
schedule = get_schedule(team_id, subject_type, subject_uuid)
if schedule is None:
return None
@@ -60,7 +60,7 @@ def update_schedule(
authorization_context: DenialContext | None = None,
interval: str | None = None,
enabled: bool | None = None,
-) -> MetricCheckSchedule:
+) -> CheckSchedule:
result = update_schedule_with_snapshots(
team_id,
subject_type,
@@ -68,5 +68,5 @@ def update_schedule(
interval=interval,
enabled=enabled,
)
- log_metric_schedule_change(team_id, str(subject_uuid), result.before, result.after, user)
+ log_schedule_change(team_id, str(subject_type), str(subject_uuid), result.before, result.after, user)
return schedule_with_history(team_id, subject_type, subject_uuid, result.after, authorization_context)
diff --git a/products/data_quality/backend/logic/schedules.py b/products/data_quality/backend/logic/schedules.py
index 0e1cc87f8230..6796e3178582 100644
--- a/products/data_quality/backend/logic/schedules.py
+++ b/products/data_quality/backend/logic/schedules.py
@@ -11,7 +11,7 @@ from posthog.models.scoping.manager import resolve_effective_team_id
from posthog.temporal.common.client import async_connect
from ..facade.enums import ScheduleInterval, SubjectType
-from .metric_schedules import MetricScheduleKey, MetricSchedules, label_from_interval
+from .subject_schedules import SCHEDULE_TYPES, SubjectScheduleKey, SubjectSchedules, label_from_interval
logger = structlog.get_logger(__name__)
SCHEDULE_REQUEST_TIMEOUT_SECONDS = 10
@@ -22,7 +22,7 @@ class ScheduleUnavailableError(Exception):
@frozen
-class MetricCheckSchedule:
+class CheckSchedule:
id: UUID
interval: ScheduleInterval
enabled: bool
@@ -33,20 +33,23 @@ class MetricCheckSchedule:
@frozen
class ScheduleUpdateResult:
- before: MetricCheckSchedule
- after: MetricCheckSchedule
+ before: CheckSchedule
+ after: CheckSchedule
-def schedule_key(team_id: int, subject_type: str, subject_uuid: str | UUID) -> MetricScheduleKey:
- if subject_type != SubjectType.METRIC:
- raise ValueError("Only metrics support recurring check schedules")
- return MetricScheduleKey(team_id=resolve_effective_team_id(team_id), metric_id=UUID(str(subject_uuid)))
+def schedule_key(team_id: int, subject_type: str, subject_uuid: str | UUID) -> SubjectScheduleKey:
+ kind = SubjectType(subject_type)
+ if kind not in SCHEDULE_TYPES:
+ raise ValueError(f"A {kind} has no recurring check schedule")
+ return SubjectScheduleKey(
+ team_id=resolve_effective_team_id(team_id), subject_type=kind, subject_uuid=UUID(str(subject_uuid))
+ )
-def schedule_snapshot(key: MetricScheduleKey, description: ScheduleDescription) -> MetricCheckSchedule:
+def schedule_snapshot(key: SubjectScheduleKey, description: ScheduleDescription) -> CheckSchedule:
schedule = description.schedule
upcoming = description.info.next_action_times
- return MetricCheckSchedule(
+ return CheckSchedule(
id=key.id,
interval=label_from_interval(schedule.spec.intervals[0].every),
enabled=not schedule.state.paused,
@@ -54,7 +57,7 @@ def schedule_snapshot(key: MetricScheduleKey, description: ScheduleDescription)
)
-async def _describe_schedule(schedules: MetricSchedules, key: MetricScheduleKey) -> MetricCheckSchedule | None:
+async def _describe_schedule(schedules: SubjectSchedules, key: SubjectScheduleKey) -> CheckSchedule | None:
async with asyncio.timeout(SCHEDULE_REQUEST_TIMEOUT_SECONDS):
description = await schedules.describe(key)
return schedule_snapshot(key, description) if description is not None else None
@@ -71,7 +74,7 @@ async def _update_schedule_with_snapshots(
key = await sync_to_async(schedule_key)(team_id, subject_type, subject_uuid)
try:
async with asyncio.timeout(SCHEDULE_REQUEST_TIMEOUT_SECONDS):
- schedules = MetricSchedules(await async_connect())
+ schedules = SubjectSchedules(await async_connect())
before = await _describe_schedule(schedules, key)
if before is None:
raise ScheduleUnavailableError()
@@ -88,21 +91,26 @@ async def _update_schedule_with_snapshots(
@async_to_sync
-async def provision_metric_schedule(team_id: int, metric_id: str) -> None:
- key = await sync_to_async(schedule_key)(team_id, SubjectType.METRIC, metric_id)
+async def provision_schedule(team_id: int, subject_type: str, subject_uuid: str) -> None:
+ key = await sync_to_async(schedule_key)(team_id, subject_type, subject_uuid)
try:
async with asyncio.timeout(SCHEDULE_REQUEST_TIMEOUT_SECONDS):
- await MetricSchedules(await async_connect()).ensure(key)
+ await SubjectSchedules(await async_connect()).ensure(key)
except Exception:
- logger.exception("data_quality_schedule_provision_failed", team_id=key.team_id, metric_id=str(key.metric_id))
+ logger.exception(
+ "data_quality_schedule_provision_failed",
+ team_id=key.team_id,
+ subject_type=str(key.subject_type),
+ subject_uuid=str(key.subject_uuid),
+ )
@async_to_sync
-async def get_schedule(team_id: int, subject_type: str, subject_uuid: str | UUID) -> MetricCheckSchedule | None:
+async def get_schedule(team_id: int, subject_type: str, subject_uuid: str | UUID) -> CheckSchedule | None:
key = await sync_to_async(schedule_key)(team_id, subject_type, subject_uuid)
try:
async with asyncio.timeout(SCHEDULE_REQUEST_TIMEOUT_SECONDS):
- description = await MetricSchedules(await async_connect()).describe(key)
+ description = await SubjectSchedules(await async_connect()).describe(key)
return schedule_snapshot(key, description) if description is not None else None
except Exception as error:
raise ScheduleUnavailableError() from error
@@ -120,7 +128,7 @@ async def set_schedule(
key = await sync_to_async(schedule_key)(team_id, subject_type, subject_uuid)
try:
async with asyncio.timeout(SCHEDULE_REQUEST_TIMEOUT_SECONDS):
- await MetricSchedules(await async_connect()).update(key, interval=interval, enabled=enabled)
+ await SubjectSchedules(await async_connect()).update(key, interval=interval, enabled=enabled)
except Exception as error:
raise ScheduleUnavailableError() from error
diff --git a/products/data_quality/backend/logic/metric_schedules.py b/products/data_quality/backend/logic/subject_schedules.py
similarity index 57%
rename from products/data_quality/backend/logic/metric_schedules.py
rename to products/data_quality/backend/logic/subject_schedules.py
index 7b672ce61b88..5631a65fe7ac 100644
--- a/products/data_quality/backend/logic/metric_schedules.py
+++ b/products/data_quality/backend/logic/subject_schedules.py
@@ -25,10 +25,16 @@ from posthog.temporal.common.schedule import a_create_schedule, a_describe_sched
from posthog.temporal.common.search_attributes import POSTHOG_SCHEDULE_TYPE_KEY, POSTHOG_TEAM_ID_KEY
from ..facade.contracts import CHECK_SUITE_WORKFLOW_NAME, RunCheckSuiteInputs
-from ..facade.enums import ScheduleInterval, SuiteRunTrigger
+from ..facade.enums import ScheduleInterval, SubjectType, SuiteRunTrigger
+
+SCHEDULE_TYPES: dict[SubjectType, str] = {SubjectType.METRIC: "data-quality-metric"}
+SCHEDULE_TYPE_SUBJECTS = {schedule_type: kind for kind, schedule_type in SCHEDULE_TYPES.items()}
+
+
+def runs_on_a_schedule(subject_type: SubjectType) -> bool:
+ return subject_type in SCHEDULE_TYPES
+
-SCHEDULE_TYPE = "data-quality-metric"
-SCHEDULE_PREFIX = f"{SCHEDULE_TYPE}:"
CATCHUP_WINDOW = timedelta(minutes=15)
INTERVALS = {
ScheduleInterval.ONE_HOUR: timedelta(hours=1),
@@ -40,24 +46,54 @@ INTERVALS = {
@frozen
-class MetricScheduleKey:
+class SubjectScheduleKey:
+ """Which subject a Temporal schedule runs the checks of."""
+
team_id: int
- metric_id: UUID
+ subject_type: SubjectType
+ subject_uuid: UUID
+
+ @property
+ def schedule_type(self) -> str:
+ schedule_type = SCHEDULE_TYPES.get(self.subject_type)
+ if schedule_type is None:
+ raise ValueError(f"A {self.subject_type} has no recurring check schedule")
+ return schedule_type
@property
def id(self) -> UUID:
- return uuid5(NAMESPACE_URL, f"{SCHEDULE_PREFIX}{self.team_id}:{self.metric_id}")
+ return uuid5(NAMESPACE_URL, self.temporal_id)
@property
def temporal_id(self) -> str:
- return f"{SCHEDULE_PREFIX}{self.team_id}:{self.metric_id}"
+ return f"{self.schedule_type}:{self.team_id}:{self.subject_uuid}"
@classmethod
- def parse(cls, schedule_id: str) -> "MetricScheduleKey":
- prefix, team_id, metric_id = schedule_id.split(":")
- if prefix != SCHEDULE_TYPE:
- raise ValueError("Unrecognized metric schedule identifier")
- return cls(team_id=int(team_id), metric_id=UUID(metric_id))
+ def parse(cls, schedule_id: str) -> "SubjectScheduleKey":
+ schedule_type, team_id, subject_uuid = schedule_id.split(":")
+ subject_type = SCHEDULE_TYPE_SUBJECTS.get(schedule_type)
+ if subject_type is None:
+ raise ValueError("Unrecognized check schedule identifier")
+ return cls(team_id=int(team_id), subject_type=subject_type, subject_uuid=UUID(subject_uuid))
+
+
+def suite_inputs(key: SubjectScheduleKey) -> RunCheckSuiteInputs:
+ """What this schedule hands the workflow, with its subject in the selector that kind uses."""
+ if key.subject_type is SubjectType.METRIC:
+ return RunCheckSuiteInputs(
+ team_id=key.team_id,
+ trigger=SuiteRunTrigger.SCHEDULED,
+ metric_ids=[str(key.subject_uuid)],
+ schedule_id=key.temporal_id,
+ )
+ raise ValueError(f"A {key.subject_type} has no recurring check schedule")
+
+
+def selected_subject_ids(inputs: RunCheckSuiteInputs, subject_type: SubjectType) -> list[str]:
+ """The subjects these inputs name, read out of the selector that kind uses."""
+ if subject_type is SubjectType.METRIC:
+ return inputs.metric_ids
+ raise ValueError(f"A {subject_type} has no recurring check schedule")
def interval_from_label(label: str) -> timedelta:
@@ -68,30 +104,25 @@ def label_from_interval(interval: timedelta) -> ScheduleInterval:
for label, duration in INTERVALS.items():
if interval == duration:
return label
- raise ValueError("Unsupported metric check interval")
+ raise ValueError("Unsupported check interval")
-class MetricSchedules:
+class SubjectSchedules:
def __init__(self, client: Client) -> None:
self.client = client
@staticmethod
- def spec(key: MetricScheduleKey, interval: str) -> ScheduleSpec:
+ def spec(key: SubjectScheduleKey, interval: str) -> ScheduleSpec:
duration = interval_from_label(interval)
offset = timedelta(seconds=key.id.int % int(duration.total_seconds()))
return ScheduleSpec(intervals=[ScheduleIntervalSpec(every=duration, offset=offset)])
@classmethod
- def build(cls, key: MetricScheduleKey, interval: str = ScheduleInterval.DAILY) -> Schedule:
+ def build(cls, key: SubjectScheduleKey, interval: str = ScheduleInterval.DAILY) -> Schedule:
return Schedule(
action=ScheduleActionStartWorkflow(
CHECK_SUITE_WORKFLOW_NAME,
- RunCheckSuiteInputs(
- team_id=key.team_id,
- trigger=SuiteRunTrigger.SCHEDULED,
- metric_ids=[str(key.metric_id)],
- schedule_id=key.temporal_id,
- ),
+ suite_inputs(key),
id=key.temporal_id,
task_queue=settings.DATA_MODELING_TASK_QUEUE,
execution_timeout=timedelta(hours=1),
@@ -102,7 +133,7 @@ class MetricSchedules:
),
)
- async def ensure(self, key: MetricScheduleKey) -> None:
+ async def ensure(self, key: SubjectScheduleKey) -> None:
try:
await a_create_schedule(
self.client,
@@ -112,14 +143,14 @@ class MetricSchedules:
search_attributes=TypedSearchAttributes(
[
SearchAttributePair(POSTHOG_TEAM_ID_KEY, key.team_id),
- SearchAttributePair(POSTHOG_SCHEDULE_TYPE_KEY, SCHEDULE_TYPE),
+ SearchAttributePair(POSTHOG_SCHEDULE_TYPE_KEY, key.schedule_type),
]
),
)
except ScheduleAlreadyRunningError:
return
- async def describe(self, key: MetricScheduleKey) -> ScheduleDescription | None:
+ async def describe(self, key: SubjectScheduleKey) -> ScheduleDescription | None:
try:
return await a_describe_schedule(self.client, key.temporal_id)
except RPCError as error:
@@ -127,7 +158,9 @@ class MetricSchedules:
return None
raise
- async def update(self, key: MetricScheduleKey, *, interval: str | None = None, enabled: bool | None = None) -> None:
+ async def update(
+ self, key: SubjectScheduleKey, *, interval: str | None = None, enabled: bool | None = None
+ ) -> None:
spec = self.spec(key, interval) if interval is not None else None
def updater(inputs: ScheduleUpdateInput) -> ScheduleUpdate:
diff --git a/products/data_quality/backend/presentation/views.py b/products/data_quality/backend/presentation/views.py
index d62f632c5edf..28c521ec4deb 100644
--- a/products/data_quality/backend/presentation/views.py
+++ b/products/data_quality/backend/presentation/views.py
@@ -715,7 +715,7 @@ class DataQualityCheckViewSet(_ProjectQualityViewSet, viewsets.ModelViewSet):
writing = request.method == "PATCH"
subject = self._named_subject(request.data if writing else request.query_params)
self._require_subject(subject, write=writing)
- if subject.subject_type != SubjectType.METRIC:
+ if not api.runs_on_a_schedule(SubjectType(subject.subject_type)):
raise ValidationError(
{"subject_type": f"A {subject.subject_type}'s checks run when its data changes, not on a schedule."}
)
@@ -726,7 +726,7 @@ class DataQualityCheckViewSet(_ProjectQualityViewSet, viewsets.ModelViewSet):
self._require_enabled_check_access(subject)
update = DataQualityCheckScheduleUpdateSerializer(data=request.data)
update.is_valid(raise_exception=True)
- schedule: api.MetricCheckSchedule | None
+ schedule: api.CheckSchedule | None
try:
if writing:
schedule = api.update_schedule(
diff --git a/products/data_quality/backend/temporal/activities/prepare_check_suite.py b/products/data_quality/backend/temporal/activities/prepare_check_suite.py
index 89e2bc0a1aa0..242e6cc01a11 100644
--- a/products/data_quality/backend/temporal/activities/prepare_check_suite.py
+++ b/products/data_quality/backend/temporal/activities/prepare_check_suite.py
@@ -13,7 +13,7 @@ from products.data_modeling.backend.facade import api as data_modeling_facade
from ...facade.enums import SubjectType, SuiteRunTrigger
from ...logic.checks import live_subject_checks
from ...logic.flags import get_data_quality_checks_flag_for_team_id
-from ...logic.metric_schedules import MetricScheduleKey, MetricSchedules
+from ...logic.subject_schedules import SubjectScheduleKey, SubjectSchedules, selected_subject_ids
from ...models import DataQualityCheck, DataQualitySuiteRun
from ..contracts import PreparedSuite, RunCheckSuiteInputs
@@ -28,10 +28,10 @@ async def prepare_check_suite_activity(inputs: RunCheckSuiteInputs) -> PreparedS
if inputs.trigger == SuiteRunTrigger.SCHEDULED:
if not inputs.schedule_id:
raise ValueError("Scheduled suites require a schedule identifier")
- key = MetricScheduleKey.parse(inputs.schedule_id)
- if key.team_id != inputs.team_id or inputs.metric_ids != [str(key.metric_id)]:
+ key = SubjectScheduleKey.parse(inputs.schedule_id)
+ if key.team_id != inputs.team_id or selected_subject_ids(inputs, key.subject_type) != [str(key.subject_uuid)]:
raise ValueError("Schedule subject does not match suite inputs")
- schedule = await MetricSchedules(await async_connect()).describe(key)
+ schedule = await SubjectSchedules(await async_connect()).describe(key)
schedule_enabled = schedule is not None and not schedule.schedule.state.paused
return await sync_to_async(_prepare)(inputs, schedule_enabled=schedule_enabled)
diff --git a/products/data_quality/backend/temporal/activities/reconcile_schedules.py b/products/data_quality/backend/temporal/activities/reconcile_schedules.py
index ffd2d2e54afe..1585c8a4c2bf 100644
--- a/products/data_quality/backend/temporal/activities/reconcile_schedules.py
+++ b/products/data_quality/backend/temporal/activities/reconcile_schedules.py
@@ -14,7 +14,7 @@ from posthog.temporal.common.search_attributes import POSTHOG_SCHEDULE_TYPE_KEY
from products.data_catalog.backend.facade import api as data_catalog_facade
from ...facade.enums import SubjectType
-from ...logic.metric_schedules import SCHEDULE_PREFIX, SCHEDULE_TYPE, MetricScheduleKey, MetricSchedules
+from ...logic.subject_schedules import SCHEDULE_TYPES, SubjectScheduleKey, SubjectSchedules
from ...models import DataQualityCheck
RECONCILE_PAGE_SIZE = 100
@@ -29,50 +29,69 @@ class ScheduleReconcileCursor:
done: bool = False
+SCHEDULED_SUBJECT_TYPES = tuple(SCHEDULE_TYPES)
+SCHEDULE_TYPE_QUERY = " OR ".join(
+ f'{POSTHOG_SCHEDULE_TYPE_KEY.name} = "{schedule_type}"' for schedule_type in SCHEDULE_TYPES.values()
+)
+
+
def _check_page(after_check_id: str | None) -> list[DataQualityCheck]:
- checks = DataQualityCheck.objects.unscoped().filter(subject_type=SubjectType.METRIC, metric__deleted=False)
+ checks = DataQualityCheck.objects.unscoped().filter(subject_type__in=SCHEDULED_SUBJECT_TYPES, metric__deleted=False)
if after_check_id:
checks = checks.filter(id__gt=after_check_id)
- return list(checks.only("id", "team_id", "metric_id").order_by("id")[:RECONCILE_PAGE_SIZE])
+ # Every subject key the property reads, or reaching for it would lazy-load inside the async
+ # TaskGroup the reconciler runs these keys in.
+ return list(
+ checks.only("id", "team_id", "subject_type", "metric_id", "saved_query_id", "table_id").order_by("id")[
+ :RECONCILE_PAGE_SIZE
+ ]
+ )
def _dead_schedules(schedule_ids: list[str]) -> list[str]:
- by_team: dict[int, list[MetricScheduleKey]] = defaultdict(list)
+ by_team: dict[int, list[SubjectScheduleKey]] = defaultdict(list)
for schedule_id in schedule_ids:
- if schedule_id.startswith(SCHEDULE_PREFIX):
- key = MetricScheduleKey.parse(schedule_id)
- by_team[key.team_id].append(key)
+ try:
+ key = SubjectScheduleKey.parse(schedule_id)
+ except ValueError:
+ continue
+ by_team[key.team_id].append(key)
dead: list[str] = []
for team_id, keys in by_team.items():
- live = data_catalog_facade.metric_names_for_ids(team_id, [key.metric_id for key in keys])
- dead.extend(key.temporal_id for key in keys if key.metric_id not in live)
+ metric_keys = [key for key in keys if key.subject_type == SubjectType.METRIC]
+ live = data_catalog_facade.metric_names_for_ids(team_id, [key.subject_uuid for key in metric_keys])
+ dead.extend(key.temporal_id for key in metric_keys if key.subject_uuid not in live)
return dead
@activity.defn
async def reconcile_metric_schedules_activity(cursor: ScheduleReconcileCursor) -> ScheduleReconcileCursor:
client = await async_connect()
- metric_schedules = MetricSchedules(client)
+ schedules = SubjectSchedules(client)
semaphore = asyncio.Semaphore(RECONCILE_CONCURRENCY_LIMIT)
if not cursor.cleanup:
checks = await database_sync_to_async_pool(_check_page)(cursor.after_check_id)
keys = list(
dict.fromkeys(
- MetricScheduleKey(team_id=check.team_id, metric_id=check.metric_id)
+ SubjectScheduleKey(
+ team_id=check.team_id,
+ subject_type=SubjectType(check.subject_type),
+ subject_uuid=check.subject_uuid,
+ )
for check in checks
- if check.metric_id
+ if check.subject_uuid
)
)
async with asyncio.TaskGroup() as tasks:
for key in keys:
- tasks.create_task(_ensure_schedule(metric_schedules, key, semaphore))
+ tasks.create_task(_ensure_schedule(schedules, key, semaphore))
return ScheduleReconcileCursor(
after_check_id=str(checks[-1].id) if checks else None,
cleanup=len(checks) < RECONCILE_PAGE_SIZE,
)
schedule_page = await client.list_schedules(
- query=f'{POSTHOG_SCHEDULE_TYPE_KEY.name} = "{SCHEDULE_TYPE}"',
+ query=SCHEDULE_TYPE_QUERY,
page_size=RECONCILE_PAGE_SIZE,
next_page_token=cursor.next_page_token,
)
@@ -87,7 +106,7 @@ async def reconcile_metric_schedules_activity(cursor: ScheduleReconcileCursor) -
)
-async def _ensure_schedule(schedules: MetricSchedules, key: MetricScheduleKey, semaphore: asyncio.Semaphore) -> None:
+async def _ensure_schedule(schedules: SubjectSchedules, key: SubjectScheduleKey, semaphore: asyncio.Semaphore) -> None:
async with semaphore:
await schedules.ensure(key)
activity.heartbeat()
diff --git a/products/data_quality/backend/tests/test_api.py b/products/data_quality/backend/tests/test_api.py
index 7549928995d0..0f0d47ce4c60 100644
--- a/products/data_quality/backend/tests/test_api.py
+++ b/products/data_quality/backend/tests/test_api.py
@@ -26,8 +26,8 @@ from products.data_modeling.backend.facade.models import DataWarehouseSavedQuery
from products.data_quality.backend.facade import api
from products.data_quality.backend.facade.enums import CheckRunStatus, CheckSeverity, CheckType, SubjectType
from products.data_quality.backend.logic import checks as checks_logic
-from products.data_quality.backend.logic.metric_schedules import MetricScheduleKey, MetricSchedules
from products.data_quality.backend.logic.runner import run_check
+from products.data_quality.backend.logic.subject_schedules import SubjectScheduleKey, SubjectSchedules
from products.data_quality.backend.models import DataQualityCheck, DataQualityCheckRun, DataQualitySuiteRun
from products.data_quality.backend.presentation.serializers import DataQualitySuiteRunSerializer
from products.data_quality.backend.presentation.views import DataQualityCheckViewSet
@@ -211,21 +211,21 @@ class TestMetricCheckAPI(APIBaseTest):
"products.data_quality.backend.logic.schedules.async_connect", AsyncMock(side_effect=TimeoutError)
)
elif phase == "initial_read":
- failure = patch.object(MetricSchedules, "describe", AsyncMock(side_effect=TimeoutError))
+ failure = patch.object(SubjectSchedules, "describe", AsyncMock(side_effect=TimeoutError))
elif phase == "update":
- failure = patch.object(MetricSchedules, "update", AsyncMock(side_effect=TimeoutError))
+ failure = patch.object(SubjectSchedules, "update", AsyncMock(side_effect=TimeoutError))
else:
- original_describe = MetricSchedules.describe
+ original_describe = SubjectSchedules.describe
calls = 0
- async def missing_after_update(schedules: MetricSchedules, key: MetricScheduleKey) -> object:
+ async def missing_after_update(schedules: SubjectSchedules, key: SubjectScheduleKey) -> object:
nonlocal calls
calls += 1
if calls == 1:
return await original_describe(schedules, key)
return None
- failure = patch.object(MetricSchedules, "describe", cast(AsyncMock, missing_after_update))
+ failure = patch.object(SubjectSchedules, "describe", cast(AsyncMock, missing_after_update))
with failure:
response = self.client.patch(f"{self.url}/schedule/", {**self.subject, "enabled": False})
assert response.status_code == 503
diff --git a/products/data_quality/backend/tests/test_schedules.py b/products/data_quality/backend/tests/test_schedules.py
index 92ad86c8747c..7d04e4f6cb94 100644
--- a/products/data_quality/backend/tests/test_schedules.py
+++ b/products/data_quality/backend/tests/test_schedules.py
@@ -14,15 +14,10 @@ from posthog.models.scoping import team_scope
from posthog.models.team import Team
from products.data_catalog.backend.facade.api import upsert_metric
-from products.data_quality.backend.facade.enums import SuiteRunTrigger
+from products.data_quality.backend.facade.enums import SubjectType, SuiteRunTrigger
from products.data_quality.backend.logic.checks import upsert_check
-from products.data_quality.backend.logic.metric_schedules import MetricScheduleKey, MetricSchedules
-from products.data_quality.backend.logic.schedules import (
- get_schedule,
- provision_metric_schedule,
- schedule_key,
- set_schedule,
-)
+from products.data_quality.backend.logic.schedules import get_schedule, provision_schedule, schedule_key, set_schedule
+from products.data_quality.backend.logic.subject_schedules import SubjectScheduleKey, SubjectSchedules
from products.data_quality.backend.models import DataQualityCheck
from products.data_quality.backend.temporal.activities.prepare_check_suite import prepare_check_suite_activity
from products.data_quality.backend.temporal.activities.reconcile_schedules import (
@@ -73,7 +68,7 @@ class TestSchedules(BaseTest):
callback()
assert len(self.temporal.schedules) == 1
set_schedule(self.team.id, "metric", self.metric.id, interval="6hour", enabled=False)
- provision_metric_schedule(self.team.id, str(self.metric.id))
+ provision_schedule(self.team.id, "metric", str(self.metric.id))
schedule = get_schedule(self.team.id, "metric", self.metric.id)
assert schedule is not None
assert schedule.interval == "6hour"
@@ -90,14 +85,14 @@ class TestSchedules(BaseTest):
checks = _check_page(None)
assert [check.metric_id for check in checks] == [self.metric.id]
self.temporal.create_schedule.side_effect = original_create
- async_to_sync(MetricSchedules(self.temporal).ensure)(self.key)
+ async_to_sync(SubjectSchedules(self.temporal).ensure)(self.key)
assert get_schedule(self.team.id, "metric", self.metric.id) is not None
def test_canonical_environment_uses_the_same_schedule(self) -> None:
child = Team.objects.create(organization=self.organization, name="child", parent_team=self.team)
assert schedule_key(child.id, "metric", self.metric.id) == self.key
- provision_metric_schedule(self.team.id, str(self.metric.id))
- provision_metric_schedule(child.id, str(self.metric.id))
+ provision_schedule(self.team.id, "metric", str(self.metric.id))
+ provision_schedule(child.id, "metric", str(self.metric.id))
assert len(self.temporal.schedules) == 1
def test_cleanup_preserves_live_subjects_and_does_not_trust_another_team(self) -> None:
@@ -149,13 +144,16 @@ class TestSchedules(BaseTest):
def test_reconciliation_bounds_overlapping_repairs_and_deduplicates_metric_checks(self) -> None:
metric_ids = [self.metric.id, self.metric.id, *(uuid4() for _ in range(RECONCILE_CONCURRENCY_LIMIT + 1))]
- checks = [SimpleNamespace(id=uuid4(), team_id=self.team.id, metric_id=metric_id) for metric_id in metric_ids]
+ checks = [
+ SimpleNamespace(id=uuid4(), team_id=self.team.id, subject_type=SubjectType.METRIC, subject_uuid=metric_id)
+ for metric_id in metric_ids
+ ]
started = asyncio.Event()
release = asyncio.Event()
active = 0
maximum_active = 0
- async def ensure(_key: MetricScheduleKey) -> None:
+ async def ensure(_key: SubjectScheduleKey) -> None:
nonlocal active, maximum_active
active += 1
maximum_active = max(maximum_active, active)
@@ -183,7 +181,7 @@ class TestSchedules(BaseTest):
"products.data_quality.backend.temporal.activities.reconcile_schedules.database_sync_to_async_pool",
return_value=page,
),
- patch.object(MetricSchedules, "ensure", AsyncMock(side_effect=ensure)) as mocked_ensure,
+ patch.object(SubjectSchedules, "ensure", AsyncMock(side_effect=ensure)) as mocked_ensure,
):
cursor = async_to_sync(run)()
@@ -250,17 +248,20 @@ class TestSchedules(BaseTest):
def test_reconciliation_cancels_failed_page_tasks_and_retries_the_same_cursor(self) -> None:
metric_ids = [self.metric.id, uuid4(), uuid4()]
- checks = [SimpleNamespace(id=uuid4(), team_id=self.team.id, metric_id=metric_id) for metric_id in metric_ids]
+ checks = [
+ SimpleNamespace(id=uuid4(), team_id=self.team.id, subject_type=SubjectType.METRIC, subject_uuid=metric_id)
+ for metric_id in metric_ids
+ ]
blocked_task_started = asyncio.Event()
blocked_task_canceled = asyncio.Event()
never_release = asyncio.Event()
- completed: list[MetricScheduleKey] = []
+ completed: list[SubjectScheduleKey] = []
- async def fail_after_partial_completion(key: MetricScheduleKey) -> None:
- if key.metric_id == metric_ids[0]:
+ async def fail_after_partial_completion(key: SubjectScheduleKey) -> None:
+ if key.subject_uuid == metric_ids[0]:
completed.append(key)
return
- if key.metric_id == metric_ids[1]:
+ if key.subject_uuid == metric_ids[1]:
await blocked_task_started.wait()
raise RuntimeError("Temporal is unavailable")
blocked_task_started.set()
@@ -273,7 +274,7 @@ class TestSchedules(BaseTest):
async def page(_after_check_id: str | None) -> list[SimpleNamespace]:
return checks
- async def retry(key: MetricScheduleKey) -> None:
+ async def retry(key: SubjectScheduleKey) -> None:
completed.append(key)
with (
@@ -286,7 +287,7 @@ class TestSchedules(BaseTest):
return_value=page,
),
patch.object(
- MetricSchedules, "ensure", AsyncMock(side_effect=fail_after_partial_completion)
+ SubjectSchedules, "ensure", AsyncMock(side_effect=fail_after_partial_completion)
) as mocked_ensure,
):
with self.assertRaises(ExceptionGroup):
@@ -296,7 +297,12 @@ class TestSchedules(BaseTest):
cursor = async_to_sync(self._reconcile_checks)()
assert cursor.after_check_id == str(checks[-1].id)
- assert completed.count(MetricScheduleKey(team_id=self.team.id, metric_id=metric_ids[0])) == 2
+ assert (
+ completed.count(
+ SubjectScheduleKey(team_id=self.team.id, subject_type=SubjectType.METRIC, subject_uuid=metric_ids[0])
+ )
+ == 2
+ )
async def _prepare_scheduled(self) -> PreparedSuite:
return await ActivityEnvironment().run(
@@ -313,7 +319,7 @@ class TestSchedules(BaseTest):
def test_scheduled_preparation_checks_temporal_state(self, _name: str, enabled: bool, exists: bool) -> None:
self._create()
if exists:
- provision_metric_schedule(self.team.id, str(self.metric.id))
+ provision_schedule(self.team.id, "metric", str(self.metric.id))
set_schedule(self.team.id, "metric", self.metric.id, enabled=enabled)
with (
patch(
diff --git a/products/data_quality/backend/tests/test_temporal_schedules.py b/products/data_quality/backend/tests/test_temporal_schedules.py
index f5ef2e5a9fc6..8b4bf335f4f4 100644
--- a/products/data_quality/backend/tests/test_temporal_schedules.py
+++ b/products/data_quality/backend/tests/test_temporal_schedules.py
@@ -14,17 +14,22 @@ from temporalio.client import (
ScheduleUpdateInput,
)
-from products.data_quality.backend.logic.metric_schedules import MetricScheduleKey, MetricSchedules
+from products.data_quality.backend.facade.enums import SubjectType
+from products.data_quality.backend.logic.subject_schedules import SubjectScheduleKey, SubjectSchedules
-class TestTemporalMetricSchedules(SimpleTestCase):
+class TestTemporalSubjectSchedules(SimpleTestCase):
def setUp(self) -> None:
- self.key = MetricScheduleKey(team_id=123, metric_id=UUID("00000000-0000-0000-0000-000000000001"))
+ self.key = SubjectScheduleKey(
+ team_id=123,
+ subject_type=SubjectType.METRIC,
+ subject_uuid=UUID("00000000-0000-0000-0000-000000000001"),
+ )
self.temporal = Mock()
self.temporal.create_schedule = AsyncMock()
self.handle = Mock(describe=AsyncMock(), update=AsyncMock())
self.temporal.get_schedule_handle.return_value = self.handle
- self.schedules = MetricSchedules(self.temporal)
+ self.schedules = SubjectSchedules(self.temporal)
async def test_creation_uses_native_cadence_and_execution_policies(self) -> None:
await self.schedules.ensure(self.key)
@@ -35,7 +40,7 @@ class TestTemporalMetricSchedules(SimpleTestCase):
assert schedule.policy.catchup_window == timedelta(minutes=15)
assert not schedule.policy.pause_on_failure
assert self.temporal.create_schedule.call_args.kwargs["trigger_immediately"]
- assert schedule.action.args[0].metric_ids == [str(self.key.metric_id)]
+ assert schedule.action.args[0].metric_ids == [str(self.key.subject_uuid)]
assert schedule.action.args[0].team_id == self.key.team_id
async def test_repeated_creation_preserves_temporal_configuration(self) -> None:
@@ -60,6 +65,11 @@ class TestTemporalMetricSchedules(SimpleTestCase):
self.handle.update.side_effect = update
await self.schedules.update(self.key, interval="6hour")
+ def test_a_metric_schedule_keeps_the_id_and_type_a_running_schedule_carries(self) -> None:
+ assert self.key.temporal_id == "data-quality-metric:123:00000000-0000-0000-0000-000000000001"
+ assert self.key.schedule_type == "data-quality-metric"
+ assert SubjectScheduleKey.parse(self.key.temporal_id) == self.key
+
async def test_pause_update_preserves_existing_interval(self) -> None:
current = self.schedules.build(self.key, interval="6hour")
diff --git a/products/data_quality/frontend/DataQualitySchedule.test.tsx b/products/data_quality/frontend/DataQualitySchedule.test.tsx
index ad4acd005776..7904ef310aa1 100644
--- a/products/data_quality/frontend/DataQualitySchedule.test.tsx
+++ b/products/data_quality/frontend/DataQualitySchedule.test.tsx
@@ -35,7 +35,7 @@ describe('DataQualitySchedule', () => {
last_suite_run: null,
})
- render(<DataQualitySchedule metricId="metric-1" />)
+ render(<DataQualitySchedule subjectType="metric" subjectId="metric-1" />)
const dueNow = await screen.findByText('due now')
expect(dueNow).toBeInTheDocument()
diff --git a/products/data_quality/frontend/MetricChecksPanel.tsx b/products/data_quality/frontend/MetricChecksPanel.tsx
index 02323beea839..0c43afb96a57 100644
--- a/products/data_quality/frontend/MetricChecksPanel.tsx
+++ b/products/data_quality/frontend/MetricChecksPanel.tsx
@@ -19,7 +19,7 @@ export function MetricChecksPanel({ metricId, newCheckDisabledReason }: MetricCh
columns={[]}
hideTitle
newCheckDisabledReason={newCheckDisabledReason}
- notice={checks.length > 0 ? <DataQualitySchedule metricId={metricId} /> : undefined}
+ notice={checks.length > 0 ? <DataQualitySchedule subjectType="metric" subjectId={metricId} /> : undefined}
/>
)
}
diff --git a/products/data_quality/frontend/dataQualityScheduleLogic.test.ts b/products/data_quality/frontend/dataQualityScheduleLogic.test.ts
index 162d9bf7e690..5a13d0b90365 100644
--- a/products/data_quality/frontend/dataQualityScheduleLogic.test.ts
+++ b/products/data_quality/frontend/dataQualityScheduleLogic.test.ts
@@ -29,7 +29,7 @@ describe('dataQualityScheduleLogic', () => {
initKeaTests()
silenceKeaLoadersErrors()
;(dataQualityChecksScheduleRetrieve as jest.Mock).mockResolvedValue(SCHEDULE)
- logic = dataQualityScheduleLogic({ metricId: 'metric-1' })
+ logic = dataQualityScheduleLogic({ subjectType: 'metric', subjectId: 'metric-1' })
})
afterEach(() => {
diff --git a/products/data_quality/frontend/dataQualityScheduleLogic.ts b/products/data_quality/frontend/dataQualityScheduleLogic.ts
index 9274b893c64b..00b0d36b7fe5 100644
--- a/products/data_quality/frontend/dataQualityScheduleLogic.ts
+++ b/products/data_quality/frontend/dataQualityScheduleLogic.ts
@@ -8,13 +8,7 @@ import type { DataQualityCheckScheduleApi, PatchedDataQualityCheckScheduleUpdate
const SCHEDULE_REFRESH_INTERVAL_MS = 30_000
-export interface DataQualityScheduleLogicProps {
- metricId: string
-}
-
-function subjectRef(props: DataQualityScheduleLogicProps): DataQualitySubjectRef {
- return { subjectType: 'metric', subjectId: props.metricId }
-}
+export type DataQualityScheduleLogicProps = DataQualitySubjectRef
export interface DataQualityScheduleError {
message: string
@@ -88,7 +82,7 @@ export type dataQualityScheduleLogicType = MakeLogicType<
export const dataQualityScheduleLogic: LogicWrapper<dataQualityScheduleLogicType> = kea<dataQualityScheduleLogicType>([
props({} as DataQualityScheduleLogicProps),
- key((props) => props.metricId),
+ key((props) => `${props.subjectType}:${props.subjectId}`),
path((key) => ['products', 'data_quality', 'frontend', 'dataQualityScheduleLogic', key]),
actions({
refreshSchedule: true,
@@ -98,16 +92,16 @@ export const dataQualityScheduleLogic: LogicWrapper<dataQualityScheduleLogicType
schedule: [
null as DataQualityCheckScheduleApi | null,
{
- loadSchedule: async () => checksApi.schedule(subjectRef(props)),
+ loadSchedule: async () => checksApi.schedule(props),
updateSchedule: async (patch: PatchedDataQualityCheckScheduleUpdateApi) => {
try {
- return await checksApi.updateSchedule(subjectRef(props), patch)
+ return await checksApi.updateSchedule(props, patch)
} catch (error) {
if (isDefinitiveRejection(error)) {
throw error
}
try {
- actions.loadScheduleSuccess(await checksApi.schedule(subjectRef(props)))
+ actions.loadScheduleSuccess(await checksApi.schedule(props))
} catch {
// The edit can have committed even when neither response reaches us.
}
@@ -141,7 +135,7 @@ export const dataQualityScheduleLogic: LogicWrapper<dataQualityScheduleLogicType
}
const previousSchedule = values.schedule
try {
- const schedule = await checksApi.schedule(subjectRef(props))
+ const schedule = await checksApi.schedule(props)
if (!values.scheduleLoading && values.schedule === previousSchedule) {
actions.refreshScheduleSuccess(schedule)
}