Spaces:
Sleeping
Sleeping
| 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"), | |
| ] | |
| g = Github(os.environ.get('github')) | |
| for name, repo_name in name2repo: | |
| repo = g.get_repo(repo_name) | |
| df = list() | |
| all_status = list() | |
| for milestone in repo.get_milestones(): | |
| desc = dict() | |
| for line in milestone.description.split('\n'): | |
| tmp = line.split(":") | |
| if len(tmp) > 1: | |
| desc[tmp[0].lower()] = tmp[1].lower().strip() | |
| 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'])) | |
| 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: | |
| df.append(dict(Task=task_name, | |
| Start='2023-04-02', | |
| Finish='2023-04-02', | |
| Resource=key)) | |
| fig = ff.create_gantt(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 | |
| 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", | |
| "align": "left", | |
| "showarrow": False, | |
| }) | |
| fig.add_hline(y=-0.5, line_width=1, line_color="grey") | |
| fig.add_hline(y=2.5, line_width=1, line_color="grey") | |
| st.plotly_chart(fig, use_container_width=True) |