CoolFace
Apppublic

harmdevries/bigcode_planning

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
6likes
app.py178 linesDownload Raw Back to root
1from github import Github2from github import Auth3import os 4import streamlit as st5import datetime6import plotly.figure_factory as ff7import plotly.graph_objects as go8import pandas as pd9import math10import copy11 12st.set_page_config(layout="wide")13name2repo = [("Dataset", "bigcode-project/bigcode-dataset"),14             ("Training", "bigcode-project/Megatron-LM"),15             # ("Evaluation", "bigcode-project/bigcode-evaluation-harness"),16             # ("Inference", "bigcode-project/bigcode-inference-benchmark"),17             # ("Legal", "bigcode-project/admin"),18             # ("Demo", "bigcode-project/bigcode-demo")19            ]20 21name2num_milestones = dict()22github_key = os.environ['github']23auth = Auth.Token(github_key)24 25g = Github(auth=auth)26df = list()27all_status = list()28bad_milestones = list()29 30 31for name, repo_name in name2repo:32    repo = g.get_repo(repo_name)33    num_milestones = 034    for milestone in repo.get_milestones():35        try:36            num_milestones += 137            desc = dict()38            for line in milestone.description.split('\n'):39                tmp = line.split(":")40                if len(tmp) > 1:41                    key = tmp[0].lower()42                    value = tmp[1].strip()43                    if key == 'status':44                        value = value.lower()45                    desc[key] = value46            task_name = f"""<a href="https://www.github.com/{repo_name}/milestone/{milestone.number}", target="_black">{milestone.title}</a>"""47            if desc['status'] not in all_status:48                all_status.append(desc['status'])49            df.append(dict(Task=task_name, 50                           Start=desc['start date'], 51                           Finish=milestone.due_on.strftime('%Y-%m-%d'), 52                           Resource=desc['status'], 53                           Description=desc['leader']))54        except:55            num_milestones -= 156            task_name = f"""<a href="https://www.github.com/{repo_name}/milestone/{milestone.number}", target="_black">{milestone.title}</a>"""57            bad_milestones.append(task_name)58    name2num_milestones[name] = num_milestones59 60copy_df = copy.deepcopy(df)61colors = {'not started': 'rgb(217, 217, 217)',62          'in progress': 'rgb(147, 196, 125)',63          'high priority - on track': 'rgb(234, 153, 153)',64          'high priority - help needed': 'rgb(255, 0, 0)',65          'completed': 'rgb(56, 118, 29)'}66 67if len(all_status) == 0:68    task_name = "None"69 70for key in colors.keys():71    if key not in all_status:72        copy_df.append(dict(Task=task_name, 73                   Start='2023-04-09', 74                   Finish='2023-04-09', 75                   Resource=key))76 77fig = ff.create_gantt(copy_df, colors=colors, 78                      index_col='Resource', 79                      show_colorbar=True, 80                      show_hover_fill=True,81                      group_tasks=True,82                      title="BigCode planning")83 84fig.update_xaxes(ticks= "outside",85                 ticklabelmode= "period", 86                 tickformat="%b",87                 tickcolor= "black", 88                 ticklen=10, 89                 range=[datetime.datetime(2023, 8, 25),90                        datetime.datetime(2023, 11, 16)],91                 minor=dict(92                     ticklen=4,  93                     dtick=7*24*60*60*1000,  94                     tick0="2023-09-01", 95                     griddash='dot', 96                     gridcolor='white')97                )98 99fig.update_layout(margin=go.layout.Margin(l=250))100fig.layout.xaxis.rangeselector = None # remove range selector on top101 102# Add today line103fig.add_vline(x=datetime.datetime.now().strftime('%Y-%m-%d'), line_width=3, line_dash="dash", line_color="black")104fig.add_annotation({105            "x": datetime.datetime.now().strftime('%Y-%m-%d'),106            "y": fig.layout.yaxis['range'][1],107            "yshift": 10,108            "text": "Today",109            "showarrow": False,110        })111 112# Add The Stack 1.2113fig.add_vline(x='2023-03-05', line_width=3, line_dash="dash", line_color="red")114fig.add_annotation({115            "x": '2023-03-05',116            "y": fig.layout.yaxis['range'][1],117            "yshift": 10,118            "text": "The Stack 1.2",119            "showarrow": False,120        })121 122# Add PII123fig.add_vline(x='2023-10-01', line_width=3, line_dash="dash", line_color="red")124fig.add_annotation({125            "x": '2023-10-01',126            "y": fig.layout.yaxis['range'][1],127            "yshift": 10,128            "text": "Model training",129            "showarrow": False,130        })131 132# Add release line133fig.add_vline(x='2023-10-31', line_width=3, line_dash="dash", line_color="red")134fig.add_annotation({135            "x": '2023-10-31',136            "y": fig.layout.yaxis['range'][1],137            "yshift": 10,138            "text": "Model release",139            "showarrow": False,140        })141 142# Add point of contacts143fig.add_annotation({144            "x": "2023-08-25",145            "y": fig.layout.yaxis['range'][1],146            "yshift": 10,147            "xanchor": "left",148            "text": "Contact",149            "showarrow": False})150for i, entry in enumerate(df[::-1]):151    fig.add_annotation(x='2023-08-25', y=i,152                text=entry['Description'],153                showarrow=False,154                xanchor="left",155                xref="x")156 157# Add working group annotations158fig.add_hline(y=-0.5, line_width=1, line_color="grey")159height = -0.5160for name, _ in name2repo[::-1]:161    if name2num_milestones[name] > 0:162        fig.add_annotation(x='2023-11-13', y=height + name2num_milestones[name]/2,163                text=name,164                showarrow=False,165                align="center",166                textangle=-90)167        height += name2num_milestones[name]168        fig.add_hline(y=height, line_width=1, line_color="grey")169 170st.plotly_chart(fig, use_container_width=True)171 172if len(bad_milestones):173    with st.expander("Bad Milestones"):174        for bms in bad_milestones:175            st.markdown(bms + "\n\n", unsafe_allow_html=True)176 177if st.button("Refresh"):178    st.experimental_rerun()