示例#1
0
def dispatch(sdos_frontend, thisObject):
	log.debug("request for MCM pseudo object: {}".format(thisObject))
	cascade = sdos_frontend.cascade
	if thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_used_partitions":
		return Response(response=treeGeometry.get_used_partitions_json(cascade=cascade), status=200, mimetype="application/json")
	elif thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_partition_mapping":
		return Response(response=treeGeometry.get_partition_mapping_json(cascade=cascade), status=200, mimetype="application/json")
	elif thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_cascade_stats":
		return Response(response=treeGeometry.get_cascade_stats_json(cascade=cascade), status=200,
		                mimetype="application/json")
	elif thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_slot_utilization10":
		return Response(response=treeGeometry.get_slot_utilization(cascade=cascade, NUMFIELDS=10), status=200,
		                mimetype="application/json")
	elif thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_slot_utilization100":
		return Response(response=treeGeometry.get_slot_utilization(cascade=cascade, NUMFIELDS=100), status=200,
		                mimetype="application/json")
	elif thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_slot_utilization1000":
		return Response(response=treeGeometry.get_slot_utilization(cascade=cascade, NUMFIELDS=1000), status=200,
		                mimetype="application/json")
	elif thisObject[len(PSEUDO_OBJECT_PREFIX):] == "sdos_slot_utilization10000":
		return Response(response=treeGeometry.get_slot_utilization(cascade=cascade, NUMFIELDS=10000), status=200,
		                mimetype="application/json")
	else:
		raise HttpError("unknown pseudo object: {}".format(thisObject))
示例#2
0
logging.basicConfig(level=configuration.log_level, format=configuration.log_format)
log = logging.getLogger()

###############################################################################
###############################################################################

if __name__ == '__main__':
	log.debug('geomtest start')
	log.debug(sys.version)
	log.debug(sys.flags)
	# frontend = Frontend.DirectFrontend(containerName='sdosTest1')
	# frontend = Frontend.CryptoFrontend(containerName='sdosTest1')
	frontend = Frontend.SdosFrontend(containerName='sdt1', swiftUser = '******', swiftKey = 'testing')
	cascade = frontend.cascade

	print(treeGeometry.get_used_partitions_json(cascade=cascade))
	print(treeGeometry.get_partition_mapping_json(cascade=cascade))
	print(treeGeometry.get_cascade_stats_json(cascade=cascade))
	treeGeometry.print_reverse_slot_mapping(cascade=cascade)
	print(treeGeometry.get_slot_utilization(cascade=cascade))