Пример #1
0
def create_time_plot_page(workflow_info ,output_dir):
	"""
	Prints the complete html page with the time chart and workflow details.
	@param workflow_stat the WorkflowInfo object reference 
	@output_dir the output directory path
	"""
	str_list = []
	wf_page = create_header(workflow_info)
	str_list.append(wf_page)
	wf_page = create_time_plot(workflow_info ,output_dir)
	str_list.append(wf_page)
	# printing the brain dump content
	if workflow_info.submit_dir is None:
		logger.warning("Unable to display brain dump contents. Invalid submit directory for workflow  " + workflow_info.wf_uuid)
	else:
		wf_page = plot_utils.print_property_table(workflow_info.wf_env,False ," : ")
		str_list.append(wf_page)
	wf_page = "\n<div style='clear: left'>\n</div></body>\n</html>"
	str_list.append(wf_page)
	data_file = os.path.join(output_dir,  workflow_info.wf_uuid+".html")
	try:
		fh = open(data_file, "w")
		fh.write( "\n")
		fh.write("".join(str_list))	
	except IOError:
		logger.error("Unable to write to file " + data_file)
		sys.exit(1)
	else:
		fh.close()	
	return
Пример #2
0
def create_time_plot_page(workflow_info, output_dir):
    """
	Prints the complete html page with the time chart and workflow details.
	@param workflow_stat the WorkflowInfo object reference 
	@output_dir the output directory path
	"""
    str_list = []
    wf_page = create_header(workflow_info)
    str_list.append(wf_page)
    wf_page = create_time_plot(workflow_info, output_dir)
    str_list.append(wf_page)
    # printing the brain dump content
    if workflow_info.submit_dir is None:
        logger.warning(
            "Unable to display brain dump contents. Invalid submit directory for workflow  "
            + workflow_info.wf_uuid)
    else:
        wf_page = plot_utils.print_property_table(workflow_info.wf_env, False,
                                                  " : ")
        str_list.append(wf_page)
    wf_page = "\n<div style='clear: left'>\n</div></body>\n</html>"
    str_list.append(wf_page)
    data_file = os.path.join(output_dir, workflow_info.wf_uuid + ".html")
    try:
        fh = open(data_file, "w")
        fh.write("\n")
        fh.write("".join(str_list))
    except IOError:
        logger.error("Unable to write to file " + data_file)
        sys.exit(1)
    else:
        fh.close()
    return
Пример #3
0
def create_host_plot_page(workflow_info, output_dir, extn="html"):
    """
	Prints the complete html page with the host chart and workflow details.
	@param workflow_stat the WorkflowInfo object reference 
	@output_dir the output directory path
	"""
    str_list = []
    wf_page = create_header(workflow_info)
    str_list.append(wf_page)
    wf_page = """
<center>
	"""
    str_list.append(wf_page)
    wf_page = create_toc(workflow_info)
    str_list.append(wf_page)
    wf_page = """<div id ='chart_div' class ='header_level2'> Host over time chart </div>"""
    str_list.append(wf_page)
    wf_page = create_host_plot(workflow_info, output_dir, extn)
    str_list.append(wf_page)
    # printing the brain dump content
    wf_page = """<div id ='env_div' class ='header_level2'> Workflow environment </div>"""
    str_list.append(wf_page)
    if workflow_info.submit_dir is None:
        logger.warning(
            "Unable to display brain dump contents. Invalid submit directory for workflow  "
            + workflow_info.wf_uuid)
    else:
        wf_page = plot_utils.print_property_table(workflow_info.wf_env, False,
                                                  " : ")
        str_list.append(wf_page)
    # print sub workflow list
    if len(workflow_info.sub_wf_id_uuids) > 0:
        wf_page = """<div id ='sub_div' class ='header_level2'> Sub workflows </div>"""
        str_list.append(wf_page)
        wf_page = plot_utils.print_sub_wf_links(workflow_info.sub_wf_id_uuids)
        str_list.append(wf_page)
    wf_page = """
</center>
	"""
    str_list.append(wf_page)
    wf_page = """
<div style='clear: left'>
</div>
</body>
</html>
	"""
    str_list.append(wf_page)
    # print html file
    data_file = os.path.join(output_dir, workflow_info.wf_uuid + "." + extn)
    try:
        fh = open(data_file, "w")
        fh.write("\n")
        fh.write("".join(str_list))
    except IOError:
        logger.error("Unable to write to file " + data_file)
        sys.exit(1)
    else:
        fh.close()
    return
Пример #4
0
def create_host_plot_page(workflow_info, output_dir, extn="html"):
    """
	Prints the complete html page with the host chart and workflow details.
	@param workflow_stat the WorkflowInfo object reference 
	@output_dir the output directory path
	"""
    str_list = []
    wf_page = create_header(workflow_info)
    str_list.append(wf_page)
    wf_page = """
<center>
	"""
    str_list.append(wf_page)
    wf_page = create_toc(workflow_info)
    str_list.append(wf_page)
    wf_page = """<div id ='chart_div' class ='header_level2'> Host over time chart </div>"""
    str_list.append(wf_page)
    wf_page = create_host_plot(workflow_info, output_dir, extn)
    str_list.append(wf_page)
    # printing the brain dump content
    wf_page = """<div id ='env_div' class ='header_level2'> Workflow environment </div>"""
    str_list.append(wf_page)
    if workflow_info.submit_dir is None:
        logger.warning(
            "Unable to display brain dump contents. Invalid submit directory for workflow  " + workflow_info.wf_uuid
        )
    else:
        wf_page = plot_utils.print_property_table(workflow_info.wf_env, False, " : ")
        str_list.append(wf_page)
        # print sub workflow list
    if len(workflow_info.sub_wf_id_uuids) > 0:
        wf_page = """<div id ='sub_div' class ='header_level2'> Sub workflows </div>"""
        str_list.append(wf_page)
        wf_page = plot_utils.print_sub_wf_links(workflow_info.sub_wf_id_uuids)
        str_list.append(wf_page)
    wf_page = """
</center>
	"""
    str_list.append(wf_page)
    wf_page = """
<div style='clear: left'>
</div>
</body>
</html>
	"""
    str_list.append(wf_page)
    # print html file
    data_file = os.path.join(output_dir, workflow_info.wf_uuid + "." + extn)
    try:
        fh = open(data_file, "w")
        fh.write("\n")
        fh.write("".join(str_list))
    except IOError:
        logger.error("Unable to write to file " + data_file)
        sys.exit(1)
    else:
        fh.close()
    return
Пример #5
0
def createOuterhtml(wf_stats, wf_info, submit_dir, output_dir):
	"""
	Generates the outer html file which links to all the charts and graph
	@param wf_info WorkflowInfo object reference
	@param wf_stats StampedeStatistics reference
	@param submit_dir submit directory
	@param output_dir the output directory path
	"""
	wf_uuid = wf_info.wf_uuid
	title =  str(wf_info.wf_uuid) + " (" + str(wf_info.dax_label) + ")"
	data_file = os.path.join(output_dir, "index.html")
	gantt_chart_parent_file = os.path.join("gantt_chart/" + wf_uuid + ".html")
	dag_graph_parent_file = os.path.join("dag_graph/" + wf_uuid + ".html")
	dax_graph_parent_file = os.path.join("dax_graph/" + wf_uuid + ".html")
	host_chart_parent_file = os.path.join("host_chart/" + wf_uuid + ".html")
	breakdown_chart_parent_file = os.path.join("breakdown_chart/" + wf_uuid + ".html")
	
	time_summary_output_dir = None
	breakdown_summary_output_dir = None
	if calc_time_chart:
		time_summary_output_dir = output_dir
		pegasus_time.setup(submit_dir, time_summary_output_dir, pegasus_env_path)
	if  calc_breakdown_chart:
		breakdown_summary_output_dir = output_dir
		pegasus_breakdown.setup(submit_dir, breakdown_summary_output_dir, pegasus_env_path)
	try:
		fh = open(data_file, "w")
		content = """
<html>
<head>
<style type ='text/css'>
#breakdown_chart{
border:2px solid orange;
}
#breakdown_chart_footer_div{
border:2px solid  #C35617;
border-top-style:none;
}
#time_chart{
border:2px solid orange;
}
#time_chart_footer_div{
border:2px solid #C35617;
border-top-style:none;
}
#breakdown_chart_legend_div{
color:#0066CC;
}
.header_level1{
font-family:"Times New Roman", Times, serif; 
font-size:36px;
}
.header_level2{
font-family:"Times New Roman", Times, serif; 
font-size:30px;
padding-top:25px;
}
</style>

</head>
<body>
<center>
<div class ='header_level1'>Pegasus plots </div>
"""
		if calc_time_chart or calc_breakdown_chart:
			content += """
<script type='text/javascript' src='js/protovis-r3.2.js'>
</script>
			"""
		if calc_gantt_chart :
			content += "<a href ='" + gantt_chart_parent_file +  "'>Workflow Execution Gantt Chart (Per workflow)</a><br/>" + NEW_LINE_STR
		if calc_host_chart :
			content += "<a href ='" + host_chart_parent_file + "'>Host Over Time Chart (Per workflow)</a><br/>" + NEW_LINE_STR
		if calc_breakdown_chart:
			content += """<a href ='#breakdown_chart_div'>Invocation Breakdown Chart (Across workflows)</a><br/>""" + NEW_LINE_STR
			content += "<a href ='" + breakdown_chart_parent_file + "'>Invocation Breakdown Chart (Per workflow)</a><br/>" + NEW_LINE_STR
		if calc_time_chart :
			content += """<a href ="#time_chart_div">Time Chart (Across workflows)</a><br/>""" + NEW_LINE_STR
		if calc_dax_graph :
			content += "<a href ='" + dax_graph_parent_file + "'>DAX graph</a><br/>" + NEW_LINE_STR
		if calc_dag_graph :
			content += "<a href ='" + dag_graph_parent_file + "'>DAG graph</a><br/>" + NEW_LINE_STR
		content += """<a href ='#env_div'> Workflow environment</a><br/><br/><br/>""" + NEW_LINE_STR
		content += """<div id ='env_div' class ='header_level2'> Workflow environment </div>"""
		content += plot_utils.print_property_table(wf_info.wf_env, False, ":")
		if calc_breakdown_chart:
			content += """
<div id ='breakdown_chart_div' class ='header_level2'> Invocation breakdown chart (Across workflows) </div>
			"""
			populate.populate_transformation_details(wf_stats, wf_info)
			logger.debug("Generating breakdown chart for the workflow " + title + " ... ")
			content += pegasus_breakdown.create_breakdown_plot(wf_info, breakdown_summary_output_dir)
		if calc_time_chart :
			populate.populate_time_details(wf_stats, wf_info)
			logger.debug("Generating time chart for the workflow " + title + " ... ")
			content += """
<div id ='time_chart_div' class ='header_level2'> Time chart (Across workflows) </div>
			"""
			content += pegasus_time.create_time_plot(wf_info, time_summary_output_dir)
		
		content += """
</center>
</body>
</html>
"""
		fh.write(content)
		plots_output = NEW_LINE_STR + "SUMMARY".center(100, '*')
		plots_output +=  NEW_LINE_STR
		plots_output +=  NEW_LINE_STR
		plots_output += "Graphs and charts generated by pegasus-plots can be viewed by opening the generated html file in the web browser  : \n" + data_file
		plots_output += NEW_LINE_STR
		plots_output +=  NEW_LINE_STR
		plots_output += "".center(100, '*')
		print plots_output
	except IOError:
		logger.error("Unable to write to file " + data_file)
		sys.exit(1)
	else:
		fh.close()