Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better summary of status of AIP-47 #24169

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 64 additions & 7 deletions dev/system_tests/update_issue_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# under the License.
import textwrap
from pathlib import Path
from typing import Optional, Tuple
from typing import Dict, List, Optional, Tuple

import rich_click as click
from github import Github
from github import Github, Issue
from rich.console import Console

console = Console(width=400, color_system="standard")
Expand Down Expand Up @@ -140,18 +140,26 @@ def update_issue_status(
"""Update status of the issues regarding the AIP-47 migration."""
g = Github(github_token)
repo = g.get_repo(repository)
issues = repo.get_issues(labels=labels.split(','))
issues = repo.get_issues(labels=labels.split(','), state='all')
max_issues = max_issues if max_issues is not None else issues.totalCount
total_re_added = 0
total_completed = 0
total_count_done = 0
total_count_all = 0
num_issues = 0
completed_open_issues: List[Issue.Issue] = []
completed_closed_issues: List[Issue.Issue] = []
not_completed_closed_issues: List[Issue.Issue] = []
not_completed_opened_issues: List[Issue.Issue] = []
per_issue_num_done: Dict[int, int] = {}
per_issue_num_all: Dict[int, int] = {}
for issue in issues[start_from : start_from + max_issues]:
console.print(f"[blue] {issue.id}: {issue.title}")
new_body, count_re_added, count_completed, count_done, count_all = process_paths_from_body(
issue.body, dry_run=dry_run, verbose=verbose
)
if count_all == 0:
continue
if count_re_added != 0 or count_completed != 0:
if dry_run:
print(new_body)
Expand All @@ -168,16 +176,65 @@ def update_issue_status(
total_completed += count_completed
total_count_done += count_done
total_count_all += count_all
per_issue_num_all[issue.id] = count_all
per_issue_num_done[issue.id] = count_done
if count_done == count_all:
if issue.state == "closed":
completed_closed_issues.append(issue)
else:
completed_open_issues.append(issue)
else:
if issue.state == "closed":
not_completed_closed_issues.append(issue)
else:
not_completed_opened_issues.append(issue)
num_issues += 1

console.print()
console.print()
console.print(f"[green]Summary of ALL performed actions: for {num_issues} issues[/]")
console.print(f"[green]Summary of ALL actions: for {num_issues} issues[/]")
console.print(f" Re-added file number: {total_re_added}")
console.print(f" Completed file number: {total_completed}")
console.print()
console.print()
console.print(f"[green]Summary of ALL issues: for {num_issues} issues[/]")
console.print(
f" Done {total_count_done}/{total_count_all} = {(total_count_done * 100/ total_count_all):.2f}%"
f" Completed and closed issues: {len(completed_closed_issues)}/{num_issues}: "
f"{len(completed_closed_issues) * 100/num_issues:.2f}%"
)
console.print(
f" Completed files {total_count_done}/{total_count_all} = "
f"{(total_count_done * 100/ total_count_all):.2f}%"
)
console.print()
if not_completed_closed_issues:
console.print("[yellow] Issues that are not completed and should be opened:[/]\n")
for issue in not_completed_closed_issues:
all = per_issue_num_all[issue.id]
done = per_issue_num_done[issue.id]
console.print(
fr" * \[[yellow]{issue.title}[/]]({issue.html_url}): "
f"{done}/{all} : {done * 100 / all:.2f}%"
)
console.print()
if completed_open_issues:
console.print("[yellow] Issues that are completed and should be closed:[/]\n")
for issue in completed_open_issues:
console.print(fr" * \[[yellow]{issue.title}[/]]({issue.html_url})")
console.print()
if not_completed_opened_issues:
console.print("[yellow] Issues that are not completed and are still opened:[/]\n")
for issue in not_completed_opened_issues:
all = per_issue_num_all[issue.id]
done = per_issue_num_done[issue.id]
console.print(
fr" * \[[yellow]{issue.title}[/]]({issue.html_url}): "
f"{done}/{all} : {done * 100 / all:.2f}%"
)
console.print()
if completed_closed_issues:
console.print("[green] Issues that are completed and are already closed:[/]\n")
for issue in completed_closed_issues:
console.print(fr" * \[[green]{issue.title}[/]]({issue.html_url})")
console.print()
console.print()


Expand Down