prevent 500 error if /tmp/observer_last_run does not exist
diff --git a/planetstack/core/views/observer.py b/planetstack/core/views/observer.py
index 67b2fde..2912db9 100644
--- a/planetstack/core/views/observer.py
+++ b/planetstack/core/views/observer.py
@@ -2,11 +2,15 @@
from monitor import driver
from core.models import *
import json
+import os
import time
def Observer(request):
+ if not os.path.exists('/tmp/observer_last_run'):
+ return HttpResponse(json.dumps({"health": ":-X", "time": time.time(), "comp": 0}))
+
t = time.time()
- status_str = open('/tmp/observer_last_run','r').read()
+ status_str = open('/tmp/observer_last_run','r').read()
d = json.loads(status_str)
comp = d['last_run'] + d['last_duration']*2 + 300
if comp>t: