Created
August 30, 2019 09:52
-
-
Save jatinchauhann/ed87f69daa5640a7b33e4670570718d5 to your computer and use it in GitHub Desktop.
get_html_header_hdfs_stats.py for HDFS Stats Tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_html_header(dataframe_all_stats, dataframe, franchise): | |
input_props = { | |
"db_name" : str(franchise).upper(), | |
"db_size" : str(get_total_size(dataframe)), | |
"db_all_size" : str(get_total_size(dataframe_all_stats)), | |
"hdfs_location_all" : get_common_location(dataframe_all_stats), | |
"hdfs_location" : get_common_location(dataframe), | |
"top_10_tables_style" : get_top_table(dataframe, 10), | |
"zerokb_tables_style" : get_zerokb_table(dataframe), | |
"style" : style | |
} | |
html_buffer = '<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"><script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>' | |
html_buffer = html_buffer + ''' | |
<style> | |
{style} | |
</style> | |
<div class="container"> | |
<h1 class="display-4 p-4 text-blue"> {db_name} Database HDFS Stats</h1> | |
<div class="row"> | |
<div class="col-sm-6"> | |
<div class="card shadow-lg p-3 mb-5 bg-white rounded"> | |
<div class="card-body"> | |
<h5 class="card-title text-blue">All Database Size</h5> | |
<p class="card-text"><p class="font-weight-light">HDFS LOCATION:</p> <h7 class="text-monospace"> {hdfs_location_all}</h7></p> | |
<p class="border-text"><span class="text-blue">SIZE:</span> {db_all_size} TB <span class="text-blue">(Without Replication)</span></p> | |
</div> | |
</div> | |
</div> | |
<div class="col-sm-6"> | |
<div class="card shadow-lg p-3 mb-5 bg-white rounded"> | |
<div class="card-body"> | |
<h5 class="card-title text-blue">{db_name} Database Size</h5> | |
<p class="card-text"><p class="font-weight-light">HDFS LOCATION:</p> <h7 class="text-monospace"> {hdfs_location}</h7></p> | |
<p class="border-text"><span class="text-blue">SIZE:</span> {db_size} TB <span class="text-blue">(Without Replication)</span></p> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<br> | |
'''.format(**input_props) | |
return html_buffer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment