def write_campaign_tier_relationship_to_report(df, head=0):
    append_report('| Campaign | Tier | DBS Size (PB - PiB) | PhEDEx Size (PB - PiB) | Ratio | Size on Disk (PB - PiB) |')
    append_report('| ------- | ------ | ------ | ------ | ------ | ------ |')

    if head != 0:
        df = df[:head]

    for index, row in df.iterrows():
        append_report('| ' + row['campaign'] + 
                      ' | ' + row['tier'] + 
                      ' | ' + bytes_to_pb_string(row['dbs_size']) + ' - ' + bytes_to_pib_string(row['dbs_size']) +
                      ' | ' + bytes_to_pb_string(row['phedex_size']) + ' - ' + bytes_to_pib_string(row['phedex_size']) +
                      ' | ' + '{:.2f}'.format(float(row['phedex_size']/row['dbs_size'])) + 
                      ' | ' + bytes_to_pb_string(row['size_on_disk']) + ' - ' + bytes_to_pib_string(row['size_on_disk']) +
                      ' |')
def write_campaigns_to_report(df, head=0):
    append_report('| Campaign | PhEDEx Size (PB - PiB) | DBS Size (PB - PiB) | Ratio | Most Significant Site | Second Most Significant Site | Most Significant Site Size (PB - PiB) | Second Most Significant Site Size (PB - PiB) | Number of Sites |')
    append_report('| ------- | ------ | ------ | ------ | ------ | ------ | ------ | ------ | ------ |')

    if head != 0:
        df = df[:head]

    for index, row in df.iterrows():
        append_report('| ' + row['campaign'] + 
                      ' | ' + bytes_to_pb_string(row['phedex_size']) + ' - ' + bytes_to_pib_string(row['phedex_size']) + 
                      ' | ' + bytes_to_pb_string(row['dbs_size']) + ' - ' + bytes_to_pib_string(row['dbs_size']) + 
                      ' | ' + '{:.2f}'.format(float(row['phedex_size']/row['dbs_size'])) + 
                      ' | ' + row['mss_name'] + 
                      ' | ' + row['second_mss_name'] + 
                      ' | ' + bytes_to_pb_string(row['mss']) + ' - ' + bytes_to_pib_string(row['mss']) + 
                      ' | ' + bytes_to_pb_string(row['second_mss']) + ' - ' + bytes_to_pib_string(row['second_mss']) + 
                      ' | ' + str(row['sites']) + 
                      ' |')
Exemple #3
0
def write_dataset_to_report(df, head=0):
    append_report('| Dataset | Sites | PhEDEx Size (PB - PiB) | Campaign |')
    append_report('| ------- | ------ | ------ | ------ |')

    if head != 0:
        df = df[:head]

    for index, row in df.iterrows():
        append_report('| ' + row['dataset'] + ' | ' + row['sites'][13:-1] +
                      ' | ' + bytes_to_pb_string(row['phedex_size']) + ' - ' +
                      bytes_to_pib_string(row['phedex_size']) + ' | ' +
                      row['campaign'] + ' |')
def plot_pie_charts(df, plot_file):
    head = df.head(6)\
             .set_index('campaign')\
             .drop(['mss_name', 'second_mss_name', 'mss', 'second_mss', 'dbs_size', 'phedex_size', 'sites'], axis=1)
    
    fig, axes = plt.subplots(2, 3, figsize=(30, 15))
    for i, (idx, row) in enumerate(head.iterrows()):
        ax = axes[i // 3, i % 3]
        row_sum = row.sum()
        row = row[row.gt(row_sum * .01)]
        ax.pie(row, labels=row.index, startangle=30, autopct=lambda val: '%s PB' % bytes_to_pb_string(val/100*row_sum))
        ax.set_title(idx)
    
    plt.tight_layout()
    plt.subplots_adjust(left=0.1, right=0.9, top=0.9, bottom=0.1, wspace=0.4)

    plot_filepath = '%s/images/%s' % (get_report_dir(), plot_file)
    plt.savefig(plot_filepath, dpi=120)