File size: 5,074 Bytes
b693c5c
c121aed
f3262d9
5e35297
1af6422
 
363c4c6
bc55598
363d1a5
0fa040d
79e6cc7
17d61e7
fc7f7cb
642c4d7
 
4912f79
17d61e7
b693c5c
727754f
c121aed
9d23aa2
 
7b04d82
 
3ebe0a0
17d61e7
 
57fc3d7
f56cccc
7b04d82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57fc3d7
e28c33a
2585038
3ebe0a0
 
 
 
 
 
 
 
 
 
 
2585038
3ebe0a0
 
 
 
2585038
3ebe0a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
02efbb2
3ebe0a0
 
 
 
 
 
 
 
 
02efbb2
 
 
 
 
 
 
 
b411370
893a718
 
 
54cd6c8
 
893a718
02efbb2
3ebe0a0
727754f
 
d190bf1
 
 
 
 
 
 
 
14eb75b
7985526
 
7b04d82
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
from github import Github
import os 
import streamlit as st
import datetime
import plotly.figure_factory as ff
import plotly.graph_objects as go
import pandas as pd
import math
import copy

st.set_page_config(layout="wide")
name2repo = [("Training", "bigcode-project/Megatron-LM"),
             ("Dataset", "bigcode-project/bigcode-dataset"),
             ("Evaluation", "bigcode-project/bigcode-evaluation-harness"),
             ("Inference", "bigcode-project/bigcode-inference-benchmark"),
             ("Legal", "bigcode-project/admin")
            ]

name2num_milestones = dict()
g = Github(os.environ.get('github'))
df = list()
all_status = list()
bad_milestones = list()


for name, repo_name in name2repo:
    repo = g.get_repo(repo_name)
    num_milestones = 0
    for milestone in repo.get_milestones():
        try:
            num_milestones += 1
            desc = dict()
            for line in milestone.description.split('\n'):
                tmp = line.split(":")
                if len(tmp) > 1:
                    key = tmp[0].lower()
                    value = tmp[1].strip()
                    if key == 'status':
                        value = value.lower()
                    desc[key] = value
            task_name = f"""<a href="https://www.github.com/{repo_name}/milestone/{milestone.number}", target="_black">{milestone.title}</a>"""
            if desc['status'] not in all_status:
                all_status.append(desc['status'])
            df.append(dict(Task=task_name, 
                           Start=desc['start date'], 
                           Finish=milestone.due_on.strftime('%Y-%m-%d'), 
                           Resource=desc['status'], 
                           Description=desc['leader']))
        except:
            num_milestones -= 1
            task_name = f"""<a href="https://www.github.com/{repo_name}/milestone/{milestone.number}", target="_black">{milestone.title}</a>"""
            bad_milestones.append(task_name)
    name2num_milestones[name] = num_milestones

copy_df = copy.deepcopy(df)
colors = {'not started': 'rgb(217, 217, 217)',
          'in progress': 'rgb(147, 196, 125)',
          'high priority - on track': 'rgb(234, 153, 153)',
          'high priority - help needed': 'rgb(255, 0, 0)',
          'completed': 'rgb(56, 118, 29)'}

if len(all_status) == 0:
    task_name = "None"

for key in colors.keys():
    if key not in all_status:
        copy_df.append(dict(Task=task_name, 
                   Start='2023-04-02', 
                   Finish='2023-04-02', 
                   Resource=key))

fig = ff.create_gantt(copy_df, colors=colors, 
                      index_col='Resource', 
                      show_colorbar=True, 
                      show_hover_fill=True,
                      group_tasks=True,
                      title="BigCode planning")

fig.update_xaxes(ticks= "outside",
                 ticklabelmode= "period", 
                 tickformat="%b",
                 tickcolor= "black", 
                 ticklen=10, 
                 range=[datetime.datetime(2022, 12, 30),
                        datetime.datetime(2023, 4, 2)],
                 minor=dict(
                     ticklen=4,  
                     dtick=7*24*60*60*1000,  
                     tick0="2023-01-01", 
                     griddash='dot', 
                     gridcolor='white')
                )

fig.update_layout(margin=go.layout.Margin(l=250))
fig.layout.xaxis.rangeselector = None # remove range selector on top

# Add today line
fig.add_vline(x=datetime.datetime.now().strftime('%Y-%m-%d'), line_width=3, line_dash="dash", line_color="black")
fig.add_annotation({
            "x": datetime.datetime.now().strftime('%Y-%m-%d'),
            "y": fig.layout.yaxis['range'][1],
            "yshift": 10,
            "text": "Today",
            "showarrow": False,
        })

# Add point of contacts
fig.add_annotation({
            "x": "2023-01-01",
            "y": fig.layout.yaxis['range'][1],
            "yshift": 10,
            "xanchor": "left",
            "text": "Contact",
            "showarrow": False})
for i, entry in enumerate(df[::-1]):
    fig.add_annotation(x='2023-01-01', y=i,
                text=entry['Description'],
                showarrow=False,
                xanchor="left",
                xref="x")

# Add working group annotations
fig.add_hline(y=-0.5, line_width=1, line_color="grey")
height = -0.5
for name, _ in name2repo[::-1]:
    if name2num_milestones[name] > 0:
        fig.add_annotation(x='2023-03-31', y=height + name2num_milestones[name]/2,
                text=name,
                showarrow=False,
                align="center",
                textangle=-90)
        height += name2num_milestones[name]
        fig.add_hline(y=height, line_width=1, line_color="grey")

st.plotly_chart(fig, use_container_width=True)

if len(bad_ms):
    with st.expander("Bad Milestones"):
        for bms in bad_milestones:
            st.markdown(bms + "\n\n", unsafe_allow_html=True)

if st.button("Refresh"):
    st.experimental_rerun()