feat(schedule):cron支持图形,RoHS检核增加进度显示
This commit is contained in:
1 parent
6d0e78be81
commit
f5aac9c893
46 files changed
+1987
-221
No files matched your search
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
backend/app/services/schedule/cron_util.py
|
||||
排程 Cron 表达式规范化与校验辅助。
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def normalize_cron_expr(expr: str | None) -> str:
|
||||
"""
|
||||
修正常见笔误:* 12,17 * * *(小时内每分钟)→ 0 12,17 * * *(整点)。
|
||||
"""
|
||||
text = str(expr or '').strip()
|
||||
parts = text.split()
|
||||
if len(parts) == 5 and parts[0] == '*' and parts[1] != '*':
|
||||
parts[0] = '0'
|
||||
return ' '.join(parts)
|
||||
return text
|
||||
|
||||
|
||||
def is_risky_cron_expr(expr: str | None) -> bool:
|
||||
"""分钟为 * 且小时已限定时,会在该小时内每分钟触发。"""
|
||||
text = str(expr or '').strip()
|
||||
parts = text.split()
|
||||
return len(parts) == 5 and parts[0] == '*' and parts[1] != '*'
|
||||
Reference in new issue
Block a user