fix: EOS run asynchronous tasks (#904)
Some checks failed
Bump Version / Bump Version Workflow (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled

Startup retention manager for asynchronous tasks. Handle gracefully
exceptions in these tasks or the configuration for them.

Remove tasks.py as repeated tasks are now handled by the retention
manager.

When running on GitHub, only the version date file is checked. The
development tag is merely a label, so any date set during development suffices.

The test_doc is also skipped on GitHub actions.
This commit is contained in:
Bobby Noelte
2026-02-24 23:17:11 +01:00
committed by GitHub
parent 378377b1ce
commit 32e690becf
11 changed files with 114 additions and 238 deletions

View File

@@ -9,6 +9,7 @@
# -----------------------------------------------------------------
import hashlib
import os
import re
import subprocess
from dataclasses import dataclass
@@ -40,6 +41,8 @@ EXCLUDED_DIR_PATTERNS: set[str] = {"*_autosum", "*__pycache__", "*_generated"}
# Excluded from hash/date calculation to avoid self-referencing loop
EXCLUDED_FILES: set[Path] = {VERSION_DATE_FILE}
IS_GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true"
# ------------------------------
# Helpers for version generation
@@ -215,30 +218,33 @@ def newest_commit_or_dirty_datetime(files: list[Path]) -> datetime:
Raises:
RuntimeError: If no version date can be determined from any source.
"""
# Check for uncommitted changes among watched files
try:
status_result = subprocess.run( # noqa: S603
["git", "status", "--porcelain", "--"] + [str(f) for f in files],
capture_output=True,
text=True,
check=True,
cwd=DIR_PACKAGE_ROOT,
)
if status_result.stdout.strip():
return datetime.now(tz=timezone.utc)
# Check for uncommitted changes among watched files.
# When running on GitHub, only the version date file is checked. The
# development tag is merely a label, so any date set during development suffices.
if not IS_GITHUB_ACTIONS:
try:
status_result = subprocess.run( # noqa: S603
["git", "status", "--porcelain", "--"] + [str(f) for f in files],
capture_output=True,
text=True,
check=True,
cwd=DIR_PACKAGE_ROOT,
)
if status_result.stdout.strip():
return datetime.now(tz=timezone.utc)
result = subprocess.run( # noqa: S603
["git", "log", "-1", "--format=%ct", "--"] + [str(f) for f in files],
capture_output=True,
text=True,
check=True,
cwd=DIR_PACKAGE_ROOT,
)
ts = result.stdout.strip()
if ts:
return datetime.fromtimestamp(int(ts), tz=timezone.utc)
except (subprocess.CalledProcessError, FileNotFoundError, ValueError): # noqa: S110
pass
result = subprocess.run( # noqa: S603
["git", "log", "-1", "--format=%ct", "--"] + [str(f) for f in files],
capture_output=True,
text=True,
check=True,
cwd=DIR_PACKAGE_ROOT,
)
ts = result.stdout.strip()
if ts:
return datetime.fromtimestamp(int(ts), tz=timezone.utc)
except (subprocess.CalledProcessError, FileNotFoundError, ValueError): # noqa: S110
pass
# Fallback to VERSION_DATE_FILE
if VERSION_DATE_FILE.exists():