Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes

  • Loading branch information...
commit d8cfd5d8b80a559c590155e6022c5c4d230c8650 1 parent daaa781
@AndreCharbonneau AndreCharbonneau authored
Showing with 20 additions and 7 deletions.
  1. +8 −6 wsgi/services/base.py
  2. +12 −1 wsgi/services/batch.py
View
14 wsgi/services/base.py
@@ -99,7 +99,12 @@ def _processReturnValue(self, s):
return s
-
+ def _should_return_json(self):
+ """
+ This method will look at the Accept header to check if we should
+ return JSON or not.
+ """
+ return cherrypy.request.headers['Accept'].lower() == "application/json"
@@ -144,8 +149,6 @@ def info(self):
HTML page providing the information listed above in
human-readable format.
"""
- acceptHeader = cherrypy.lib.cptools.accept()
- logging.debug('Accept header: %s' % (acceptHeader))
d = {}
d['name'] = self.getName()
@@ -154,7 +157,7 @@ def info(self):
d['institution'] = self.getInstitution()
d['releaseTime'] = str(self.getReleaseTime())
- if acceptHeader == 'application/json':
+ if self._should_return_json():
return json.dumps(d)
else:
return HtmlUtils().dictToPage(d)
@@ -188,11 +191,10 @@ def stats(self):
local time. If you reset your invocations value to zero or it
wraps around, please update this value accordingly.
"""
- acceptHeader = cherrypy.lib.cptools.accept()
d = {}
d['invocations'] = str(self.getInvocations())
d['lastReset'] = str(self.getLastReset())
- if acceptHeader == 'application/json':
+ if self._should_return_json():
return json.dumps(d)
else:
return HtmlUtils().dictToPage(d)
View
13 wsgi/services/batch.py
@@ -9,7 +9,18 @@ def __init__(self, d):
def getInvocations(self):
- return self.r.get('nep52-client-boot')
+ #return self.r.get('nep52-client-boot')
+ values = {}
+ values['Number of Cloud Scheduler boots'] = self.r.get('nep52-cs-boot')
+ values['Cloud Scheduler hours'] = self.r.get('nep52-cs-clock')
+
+ values['Number of CVMFS appliance boots'] = self.r.get('nep52-cvmfs-boot')
+ values['CVMFS appliance hours'] = self.r.get('nep52-cvmfs-clock')
+
+ values['Number of batch client boots'] = self.r.get('nep52-client-boot')
+ values['Batch client hours'] = self.r.get('nep52-client-clock')
+ return values
+
def getLastReset(self):
return self.r.get('nep52-reset-date')
Please sign in to comment.
Something went wrong with that request. Please try again.