Parses and classifies cron job execution data to detect failures or overdue tasks. Use this for monitoring automated background job health.
# Source: https://github.com/pnascimento9596/cron-status-alert | License: MIT | Copyright 2026 Paulo (pnascimento9596)
# Provided via justclaw.it.com; keep this notice with the code.
"""Read/classify cron jobs: scope filter and alert conditions (pure)."""
from __future__ import annotations
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, Iterable, List, Optional, Set
# Alert condition names (stable keys for state + messages)
RUN_FAILED = "RUN_FAILED"
DELIVERY_FAILED = "DELIVERY_FAILED"
OVERDUE = "OVERDUE"
ALL_CONDITIONS: frozenset[str] = frozenset(
{RUN_FAILED, DELIVERY_FAILED, OVERDUE}
)
def parse_iso(value: Any) -> Optional[datetime]:
"""Parse ISO timestamps from cron job fields; return None if unusable."""
if value is None or value == ""
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key