def generate_html(p, templateFile, templateDict, outputFile, overwrite, logger):
if not Util.check_file_exists(templateFile):
logger.error("Template file does not exist: '%s'" %(templateFile))
os._exit(-1)
try:
template = jinja2.Environment(loader = jinja2.FileSystemLoader(searchpath=os.path.split(templateFile)[0])).get_template(os.path.split(templateFile)[1])
except Exception, e:
logger.error("Failed load template file '%s'" %(templateFile), exc_info=True)
os._exit(-1)
html = bokeh.embed.file_html(models=p, resources=bokeh.resources.INLINE, title=templateDict["title"] , template=template, template_variables=templateDict)
if Util.check_file_exists(outputFile) and not overwrite:
logger.error("Html file does exist: '%s'. Delete or use overwrite flag." %(outputFile))
os._exit(-1)
try:
file = open(outputFile,"w")
file.write(html)
file.close()
except Exception, e:
logger.error("Error while writing html file '%s'" %(outputFile), exc_info=True)
os._exit(-1)
# generates bokeh histogram_data
# gets data from every "LatencyList"
# data2 is just data/2.0
# commented out code is old and better to read but much slower due to "key not in" - if
评论列表
文章目录