Commit 6804cb1f authored by Caillat Michel's avatar Caillat Michel
Browse files

Integrate all the new functionalities about the memory management/monitoring

parent b851fecb
This diff is collapsed.
......@@ -25,7 +25,7 @@ baseUrl = "/artemix"
logger = None
dm = None
import dataManager_michel as dataManager
import dataManager_michel_new as dataManager
#####################################################################
# #
......@@ -139,7 +139,7 @@ def degToHMSDMS():
dec = getFloatValue(request.GET['dec'])
sessionID = request.GET['sessionID']
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.degToHMSDMS(ra, dec, fileName, sessionID))
return json.dumps(dm.degToHMSDMS(ra, dec, fileName))
"""
......@@ -158,7 +158,7 @@ def rangeToHMS():
step = getIntValue(request.GET['step'])
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.rangeToHMS(start, end, step, fileName, sessionID))
return json.dumps(dm.rangeToHMS(start, end, step, fileName))
"""
Given a FITS filename and an interval of positive integers values and
......@@ -176,7 +176,7 @@ def rangeToDMS():
step = getIntValue(request.GET['step'])
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.rangeToDMS(start, end, step, fileName, sessionID))
return json.dumps(dm.rangeToDMS(start, end, step, fileName))
"""
Given fileName read corresponding the FITS file in memory
......@@ -185,10 +185,13 @@ def rangeToDMS():
@route( baseUrl+'/setData', name='setData', method='GET')
@enable_cors
def setData():
fileName = rebuildFilename(request.GET['fileName'])
logger.debug("setData : entering")
relFITSFilePath = rebuildFilename(request.GET['fileName'])
sessionID = request.GET['sessionID']
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.setData(fileName, sessionID))
result = dm.setData(relFITSFilePath)
logger.debug("setData : exiting")
return json.dumps(result)
"""
Given filename return the shape of the data cube contained
......@@ -202,7 +205,7 @@ def getDimensions():
sessionID = request.GET['sessionID']
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.getDimensions(fileName, sessionID))
return json.dumps(dm.getDimensions(fileName))
"""
Given a multidimensional array l
......@@ -246,13 +249,16 @@ def getPixelValueAtiFreqiRAiDEC():
@route( baseUrl+'/getSlice', name='getSlice', method='GET')
@enable_cors
def getSlice():
logger.debug("getSlice - wrapper : entering" )
fileName = rebuildFilename(request.GET['fileName'])
relFITSFilePath = rebuildFilename(request.GET['fileName'])
sessionID = request.GET['sessionID']
sliceNumb = int(request.GET['sliceNumb'])
step = int(request.GET['step'])
result = dm.getSlice(sliceNumb, step, fileName, sessionID)
result = dm.getSlice(sliceNumb, step, relFITSFilePath)
response.content_type = "application/json; charset=utf-8"
logger.debug("getSlice - wrapper : exiting" )
return json.dumps(result)
"""
......@@ -263,16 +269,19 @@ def getSlice():
@route( baseUrl+'/getFreq', name='getFreq', method='GET')
@enable_cors
def getFreq():
logger.debug("getFreq - wrapper : entering" )
fileName = rebuildFilename(request.GET['fileName'])
relFITSFilePath = rebuildFilename(request.GET['fileName'])
sessionID = request.GET['sessionID']
x = getIntValue(request.GET['x'])
y = getIntValue(request.GET['y'])
startZ = getIntValue(request.GET['startZ'])
endZ = getIntValue(request.GET['endZ'])
response.content_type = "application/json; charset=utf-8"
result = json.dumps(dm.getFreq(relFITSFilePath, x, y, startZ, endZ))
logger.debug("getFreq - wrapper : exiting" )
return json.dumps(dm.getFreq(fileName, sessionID, x, y, startZ, endZ))
return result
"""
Given two pairs -- startX,endX and startY,endY -- defining a rectangular area the RAxDEC plane
......@@ -291,6 +300,7 @@ def getFreq():
@route( baseUrl+'/getAverageSpectrum', name='getAverageSpectrum', method='GET')
@enable_cors
def getAverageSpectrum():
logger.debug("getAverageSpectrum - wrapper : entering" )
relFITSFilePath = rebuildFilename(request.GET['relFITSFilePath'])
sessionID = request.GET['sessionID']
......@@ -301,8 +311,9 @@ def getAverageSpectrum():
endX = getIntValue(request.GET['endX'])
retFITS = getBoolValue(request.GET['retFITS'])
response.content_type = "application/json; charset=utf-8"
result = json.dumps(dm.getAverageSpectrum(relFITSFilePath, startY, endY, startX, endX, retFITS))
logger.debug("getAverageSpectrum - wrapper : exiting" )
result = json.dumps(dm.getAverageSpectrum(relFITSFilePath, sessionID, startY, endY, startX, endX, retFITS))
return result
"""
......@@ -324,7 +335,7 @@ def getSumOverSliceRectArea():
sliceIndex = getIntValue(request.GET['sliceIndex'])
response.content_type = "application/json; charset=utf-8"
result = json.dumps(dm.getSumOverSliceRectArea(relFITSFilePath, sessionID, sliceIndex, RAPix0, RAPix1, DECPix0, DECPix1))
result = json.dumps(dm.getSumOverSliceRectArea(relFITSFilePath, sliceIndex, RAPix0, RAPix1, DECPix0, DECPix1))
return result
"""
......@@ -346,7 +357,7 @@ def getAverage():
endX = getIntValue(request.GET['endX'])
startZ = getIntValue(request.GET['startZ'])
endZ = getIntValue(request.GET['endZ'])
result = dm.getAverage(fileName, sessionID, step, startZ, endZ, startY, endY, startX, endX)
result = dm.getAverage(fileName, step, startZ, endZ, startY, endY, startX, endX)
response.content_type = "application/json; charset=utf-8"
return json.dumps(result)
......@@ -375,11 +386,15 @@ def createFits():
@route( baseUrl+'/getHeader', name='getHeader', method='GET')
@enable_cors
def getHeader():
fileName = rebuildFilename(request.GET['fileName'])
global logger
global dm
logger.debug("getHeader : entering")
relFITSFilePath = rebuildFilename(request.GET['fileName'])
logger.debug(f"relFITSFilePath = {relFITSFilePath}")
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.getHeader(fileName))
result = json.dumps(dm.getHeader(relFITSFilePath))
logger.debug("getHeader : exiting")
return result
"""
Given fileName
......@@ -390,11 +405,9 @@ def getHeader():
@enable_cors
def RADECRangeInDegrees():
fileName = rebuildFilename(request.GET['fileName'])
sessionID = request.GET['sessionID']
response.content_type = "application/json; charset=utf-8"
return json.dumps(dm.RADECRangeInDegrees(fileName, sessionID))
return json.dumps(dm.RADECRangeInDegrees(fileName))
"""
Given relFITSFilePath and sliceIndex
......@@ -421,7 +434,7 @@ def getOneSliceAsPNG():
lutName = body['lutName']
vmName = body['vmName']
sessionID = getIntValue(body['sessionID'])
ret = dm.getOneSliceAsPNG(sessionID, sliceIndex, relFITSFilePath, ittName,lutName, vmName)
ret = dm.getOneSliceAsPNG(sliceIndex, relFITSFilePath, ittName,lutName, vmName)
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exc()
......@@ -454,7 +467,7 @@ def getSummedSliceRangeAsPNG():
lutName = body['lutName']
vmName = body['vmName']
sessionID = getIntValue(body['sessionID'])
ret = dm.getSummedSliceRangeAsPNG(sessionID, sliceIndex0, sliceIndex1, relFITSFilePath, ittName, lutName, vmName);
ret = dm.getSummedSliceRangeAsPNG(sliceIndex0, sliceIndex1, relFITSFilePath, ittName, lutName, vmName);
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
message = "%s ! %s" % (type(e), "".join(traceback.format_list(traceback.extract_tb(exc_traceback))))
......@@ -519,14 +532,35 @@ def getEntries() :
@route( baseUrl+'/renderingCapabilities', name='renderingCapabilities', method='GET')
@enable_cors
def renderingCapabilities():
logger.debug("renderingCapabilities : entering")
logger.debug("renderingCapabilities wrapper : entering")
response.content_type = "application/json; charset=utf-8"
try :
ret = dm.renderingCapabilities()
except Exception as e:
ret = {"result": False, "message": "%s"%e, "result": None}
logger.debug("renderingCapabilities : exiting")
return json.dumps(ret)
result = dm.renderingCapabilities()
logger.debug("renderingCapabilities wrapper : exiting")
return json.dumps(result)
"""
Returns a collection of informations about the DatBlocks present
in memory at the time of the call.
"""
@route( baseUrl+'/getDataBlockInfos', name='getDataBlockInfos', method='POST')
@enable_cors
def getDataBlockInfos():
logger.debug("getDataBlockInfos wrapper : entering")
result = dm.getDataBlockInfos()
logger.debug("getDataBlockInfos wrapper : exiting")
return json.dumps(result)
"""
Erase the DataBlocks idle for a duration greater than DataBlock.getMaxIdle
(env var YAFITSS_MAXIDLE)
"""
@route( baseUrl+'/purgeDataBlocks', name='purgeDataBlocks', method='POST')
@enable_cors
def purgeDataBlocks():
logger.debug("purgeDataBlocks wrapper : entering")
result = dm.purgeDataBlocks()
logger.debug("purgeDataBlocks wrapper : exiting")
return json.dumps(result)
#
# End of the class
......@@ -556,7 +590,7 @@ def main(argv):
if opt in ('-p', '--port'):
port = int(arg)
logger = logging.getLogger('serverWsgi.michel')
logger = logging.getLogger('serverWsgi.michel.new')
logger.setLevel(logging.DEBUG)
# create console handler and set level to debug
......@@ -588,7 +622,6 @@ def main(argv):
dm = dataManager.DataManagerImpl(logger)
app = default_app()
run(host=hostname, port=port, debug=True, quiet=False)
return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment