chore: [workflow] 提交工作区代码
This commit is contained in:
1 parent
2ff588a65d
commit
01f3d7aaf7
131 files changed
+24306
-1320
No files matched your search
@@ -84,14 +84,13 @@ def test_tick_launches_due_workflow_once_and_persists_slot(tmp_path: Path) -> No
|
||||
scheduler.tick(now)
|
||||
|
||||
assert {item[0] for item in launcher.launched} == {
|
||||
"content.summary.weekly",
|
||||
"product.persona.daily",
|
||||
"shop.douyin_price_appeal",
|
||||
"product.ecommerce_costs.daily",
|
||||
"product.tmall_baibu_apply",
|
||||
}
|
||||
assert set(started) == {item[0] for item in launcher.launched}
|
||||
state = json.loads((tmp_path / "state" / "scheduler" / "state.json").read_text(encoding="utf-8"))
|
||||
assert state["jobs"]["product.persona.daily"]["slot"].startswith("2026-07-28T10:00:00")
|
||||
assert state["jobs"]["shop.douyin_price_appeal"]["slot"].startswith("2026-07-28T10:00:00")
|
||||
|
||||
|
||||
def test_completed_process_is_recorded_and_not_relaunched(tmp_path: Path) -> None:
|
||||
@@ -100,14 +99,14 @@ def test_completed_process_is_recorded_and_not_relaunched(tmp_path: Path) -> Non
|
||||
scheduler = PythonScheduler(catalog, tmp_path, launcher=launcher, misfire_grace_seconds=600)
|
||||
now = datetime(2026, 7, 28, 23, 5, tzinfo=SHANGHAI)
|
||||
scheduler.tick(now)
|
||||
process = next(item[3] for item in launcher.launched if item[0] == "product.alert.daily")
|
||||
process = next(item[3] for item in launcher.launched if item[0] == "shop.douyin_price_appeal")
|
||||
process.return_code = 0
|
||||
|
||||
scheduler.tick(now)
|
||||
|
||||
state = scheduler.status()
|
||||
assert state["jobs"]["product.alert.daily"]["status"] == "success"
|
||||
assert sum(item[0] == "product.alert.daily" for item in launcher.launched) == 1
|
||||
assert state["jobs"]["shop.douyin_price_appeal"]["status"] == "success"
|
||||
assert sum(item[0] == "shop.douyin_price_appeal" for item in launcher.launched) == 1
|
||||
|
||||
|
||||
def test_multiple_daily_slots_launch_once_without_overlap(tmp_path: Path) -> None:
|
||||
@@ -207,13 +206,19 @@ def test_misfire_older_than_grace_is_not_launched(tmp_path: Path) -> None:
|
||||
def test_configured_schedules_disable_cookie_refresh_job() -> None:
|
||||
catalog = WorkflowCatalog.load(PROJECT_ROOT / "config")
|
||||
|
||||
assert len(catalog.schedules) == 29
|
||||
assert len(catalog.schedules) == 35
|
||||
assert [
|
||||
schedule.workflow_id for schedule in catalog.schedules if not schedule.enabled
|
||||
] == [
|
||||
"content.metrics.backfill",
|
||||
"content.marketing_report.daily",
|
||||
"content.relogin.weekly",
|
||||
"content.summary.weekly",
|
||||
"content.summary.monthly",
|
||||
"content.creator_report.monthly",
|
||||
"product.alert.daily",
|
||||
"product.style_analysis.interval",
|
||||
"supply.purchase_confirmation.daily",
|
||||
"supply.replenishment.weekly",
|
||||
]
|
||||
|
||||
@@ -223,7 +228,7 @@ def test_dry_run_reports_due_without_writing_state(tmp_path: Path) -> None:
|
||||
launcher = FakeLauncher()
|
||||
scheduler = PythonScheduler(catalog, tmp_path, launcher=launcher, misfire_grace_seconds=600, dry_run=True)
|
||||
due = scheduler.tick(datetime(2026, 7, 28, 10, 5, tzinfo=SHANGHAI))
|
||||
assert "product.persona.daily" in due
|
||||
assert "shop.douyin_price_appeal" in due
|
||||
assert launcher.launched == []
|
||||
assert not (tmp_path / "state" / "scheduler" / "state.json").exists()
|
||||
|
||||
|
||||
Reference in new issue
Block a user