mirror of
https://github.com/Alkatrazz24/Funk-lab.git
synced 2026-07-11 16:34:43 +02:00
feat(hermes-auto-improve): passe quotidienne complète à 22h (tous les docs)
- Ajout systemd timer hermes-auto-improve-daily.timer (22h00, Persistent=true) - Service oneshot : --all puis --daily-pr (TimeoutSec=7200 pour 28 fichiers) - auto-improve.py : flag --all qui bypass MAX_FILES et traite tout admin/ - trigger-server.py : timeout 600s → 7200s pour les runs --all via HTTP La rotation par batch (MAX_FILES=5) reste active pour les triggers n8n à la demande. Le workflow n8n 30-min doit être désactivé manuellement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3780c90804
commit
7d02efd9fa
6 changed files with 60 additions and 7 deletions
|
|
@ -5,6 +5,10 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
|
- name: Reload systemd daemon
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Reload nftables
|
- name: Reload nftables
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nftables
|
name: nftables
|
||||||
|
|
|
||||||
|
|
@ -47,3 +47,24 @@
|
||||||
state: started
|
state: started
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
|
- name: Deploy daily service (oneshot — analyse complète)
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: hermes-auto-improve-daily.service.j2
|
||||||
|
dest: /etc/systemd/system/hermes-auto-improve-daily.service
|
||||||
|
mode: '0644'
|
||||||
|
notify: Reload systemd daemon
|
||||||
|
|
||||||
|
- name: Deploy daily timer (22h00)
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: hermes-auto-improve-daily.timer.j2
|
||||||
|
dest: /etc/systemd/system/hermes-auto-improve-daily.timer
|
||||||
|
mode: '0644'
|
||||||
|
notify: Reload systemd daemon
|
||||||
|
|
||||||
|
- name: Enable and start daily timer
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: hermes-auto-improve-daily.timer
|
||||||
|
enabled: true
|
||||||
|
state: started
|
||||||
|
daemon_reload: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Hermes Auto-Improve — Analyse quotidienne complète (tous les docs)
|
||||||
|
After=network-online.target hermes-agent.service
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/local/bin/hermes-auto-improve --all
|
||||||
|
ExecStartPost=/usr/local/bin/hermes-auto-improve --daily-pr
|
||||||
|
TimeoutSec=7200
|
||||||
|
Environment=HOME=/root
|
||||||
|
StandardOutput=journal
|
||||||
|
StandardError=journal
|
||||||
|
SyslogIdentifier=hermes-auto-improve-daily
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Hermes Auto-Improve — Timer quotidien 22h00
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*-*-* 22:00:00
|
||||||
|
Persistent=true
|
||||||
|
RandomizedDelaySec=300
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
|
@ -213,6 +213,7 @@ def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--daily-pr", action="store_true", help="Créer PR GitHub + résumé journalier")
|
parser.add_argument("--daily-pr", action="store_true", help="Créer PR GitHub + résumé journalier")
|
||||||
parser.add_argument("--dry-run", action="store_true", help="Analyser sans écrire ni push")
|
parser.add_argument("--dry-run", action="store_true", help="Analyser sans écrire ni push")
|
||||||
|
parser.add_argument("--all", action="store_true", help="Analyser tous les fichiers en une passe (ignore MAX_FILES)")
|
||||||
parser.add_argument("--subdir", default=None, help="Sous-dossier admin/ (ex: ia, k8s)")
|
parser.add_argument("--subdir", default=None, help="Sous-dossier admin/ (ex: ia, k8s)")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
@ -254,13 +255,16 @@ def main():
|
||||||
if "hermes/builtin" not in str(f) # ne pas analyser ses propres rapports
|
if "hermes/builtin" not in str(f) # ne pas analyser ses propres rapports
|
||||||
]
|
]
|
||||||
|
|
||||||
# Rotation : reprend là où il s'est arrêté
|
if args.all:
|
||||||
todo = [f for f in all_md if str(f) not in state["processed"]]
|
batch = all_md
|
||||||
if not todo:
|
|
||||||
state["processed"] = []
|
state["processed"] = []
|
||||||
todo = all_md
|
else:
|
||||||
|
# Rotation : reprend là où il s'est arrêté
|
||||||
batch = todo[:MAX_FILES]
|
todo = [f for f in all_md if str(f) not in state["processed"]]
|
||||||
|
if not todo:
|
||||||
|
state["processed"] = []
|
||||||
|
todo = all_md
|
||||||
|
batch = todo[:MAX_FILES]
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
# ── Analyse ───────────────────────────────────────────────────
|
# ── Analyse ───────────────────────────────────────────────────
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ def run_script(extra_args: list = None):
|
||||||
with open(LOG_FILE, "a") as log:
|
with open(LOG_FILE, "a") as log:
|
||||||
log.write(f"\n=== {datetime.now().isoformat()} — {' '.join(cmd)} ===\n")
|
log.write(f"\n=== {datetime.now().isoformat()} — {' '.join(cmd)} ===\n")
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
cmd, capture_output=True, text=True, timeout=600
|
cmd, capture_output=True, text=True, timeout=7200
|
||||||
)
|
)
|
||||||
log.write(result.stdout)
|
log.write(result.stdout)
|
||||||
if result.stderr:
|
if result.stderr:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue