From 81b39ad5ceaf0a2fa2db06f6c51d5a0e41f55253 Mon Sep 17 00:00:00 2001 From: Daniel Thornton Date: Tue, 7 Apr 2015 10:41:01 -0700 Subject: [PATCH] add last_commit file for monitoring when a rule last completed --- inferno/lib/daemon.py | 1 + inferno/lib/pid.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/inferno/lib/daemon.py b/inferno/lib/daemon.py index 55e2dd1..3ae31ed 100644 --- a/inferno/lib/daemon.py +++ b/inferno/lib/daemon.py @@ -63,6 +63,7 @@ def run_rule_async(rule_name, settings): if rule.retry: # Failed before, however, ran successfully this time. Clean up fail/retry files pid.clean_up(pid_dir, rule) + pid.create_last_complete(pid_dir, rule) finally: pid.remove_pid(pid_dir, rule) os._exit(0) diff --git a/inferno/lib/pid.py b/inferno/lib/pid.py index 02cdc0b..2aa0f2b 100644 --- a/inferno/lib/pid.py +++ b/inferno/lib/pid.py @@ -38,6 +38,10 @@ def should_run(pid_dir, rule): return False +def create_last_complete(pid_dir, rule): + Datefile(pid_dir, "%s.last_complete" % rule.name, timestamp=datetime.utcnow()) + + def create_last_run(pid_dir, rule): Datefile(pid_dir, "%s.last_run" % rule.name, timestamp=datetime.utcnow())