Tools: Weekly Report Generator #110652

Merged
Germano Cavalcante merged 1 commits from mano-wii/blender:weekly_report_generator into main 2023-08-04 19:32:31 +02:00

This commit implements 2 triage tools:

  • /tools/triage/weekly_report.py
  • /tools/triage/issues_needing_info.py

These tools automatically detect the username to list activities related to the user.


Solutions:

  • weekly_report.py: this is a report generator that mimics the old one seen in https://projects.blender.org/blender/blender-dev-tools/src/branch/blender-v3.4-release/utils/weekly_report.py. This tool uses the Gitea API that lists a user's activities. Once the Issues and Pull involved for the week are obtained, each of their links are accessed to see the events that do not appear in the activity feed (such as applying labels). With these labels it is possible to know why an issue was closed for example. The downside of this solution is that issues that the triager has tagged as confirmed or needing info but not commented on are not tracked.

  • issues_needing_info.py: this tool prints the links of issues that the user marked as needing information at least 1 week ago. It uses the Gitea API to first list all issues marked as needing information and updated more than a week ago, and then accesses the events for each one to filter them based on user.

Each of these files access the gitea_utils.py modules.

This commit implements 2 triage tools: - /tools/triage/weekly_report.py - /tools/triage/issues_needing_info.py These tools automatically detect the username to list activities related to the user. --- **Solutions:** - `weekly_report.py`: this is a report generator that mimics the old one seen in https://projects.blender.org/blender/blender-dev-tools/src/branch/blender-v3.4-release/utils/weekly_report.py. This tool uses the Gitea API that lists a user's activities. Once the Issues and Pull involved for the week are obtained, each of their links are accessed to see the events that do not appear in the activity feed (such as applying labels). With these labels it is possible to know why an issue was closed for example. The downside of this solution is that issues that the triager has tagged as confirmed or needing info but not commented on are not tracked. - `issues_needing_info.py`: this tool prints the links of issues that the user marked as needing information at least 1 week ago. It uses the Gitea API to first list all issues marked as needing information and updated more than a week ago, and then accesses the events for each one to filter them based on user. Each of these files access the `gitea_utils.py` modules.
Germano Cavalcante added the
Module
Triaging
label 2023-07-31 15:23:40 +02:00
Germano Cavalcante requested review from Brecht Van Lommel 2023-07-31 15:24:40 +02:00
Germano Cavalcante requested review from Philipp Oeser 2023-07-31 15:24:41 +02:00
Germano Cavalcante requested review from Arnd Marijnissen 2023-07-31 15:24:41 +02:00
Miguel Pozo added a new dependency 2023-07-31 15:41:59 +02:00

Is the idea that there will be just one script, and the question is which one is preferred? If not at least there should be a more informative name than v2.

I don't use these scripts, so maybe ask for feedback from @lichtwerk and others that are using these.

The purpose of the shell scripts is not clear to me, why not run the python file directly like other scripts in tools?

Is the idea that there will be just one script, and the question is which one is preferred? If not at least there should be a more informative name than v2. I don't use these scripts, so maybe ask for feedback from @lichtwerk and others that are using these. The purpose of the shell scripts is not clear to me, why not run the python file directly like other scripts in tools?
Author
Member

In fact the shell scripts are not needed here. (I tend to use it a lot in other cases and ended up forgetting that it's not necessary here).

  • Removed weekly_report_v2.py and shell scripts
  • Commits are now retrieved from the activity feed itself, this has resulted in a huge simplification of the script as git directories are no longer needed (except for getting the username)
  • Removed git_utils.py (Created a git_username_detect function in weekly_report.py itself)
In fact the shell scripts are not needed here. (I tend to use it a lot in other cases and ended up forgetting that it's not necessary here). - Removed `weekly_report_v2.py` and shell scripts - Commits are now retrieved from the activity feed itself, this has resulted in a huge simplification of the script as git directories are no longer needed (except for getting the username) - Removed `git_utils.py` (Created a `git_username_detect` function in `weekly_report.py` itself)
Brecht Van Lommel requested changes 2023-08-01 18:58:11 +02:00
Brecht Van Lommel left a comment
Owner

Nice simplification.

I only have minor comments on the implementation.

Nice simplification. I only have minor comments on the implementation.
@ -0,0 +7,4 @@
def url_json_get(url):
import json

These kinds of lazy imports are not needed in scripts like this. We do it in Blender for faster startup, but here it's not a factor.

These kinds of lazy imports are not needed in scripts like this. We do it in Blender for faster startup, but here it's not a factor.
mano-wii marked this conversation as resolved
@ -0,0 +201,4 @@
result.append(event)
if len(issue_events_json) < 50:

This assumes the limit will always be 50, which I don't think is a guarantee.

What you could do is use &page={page}&limit={limit} above to specifically request this limit.

This assumes the limit will always be 50, which I don't think is a guarantee. What you could do is use `&page={page}&limit={limit}` above to specifically request this limit.
mano-wii marked this conversation as resolved
@ -0,0 +4,4 @@
"""
# This script prints the URLs of all opened issues labeled
# "Status/Needs Information from User" by a specified user
# before a specified date.

Might as well say 7 days since there is no argument to specify the date.

Might as well say 7 days since there is no argument to specify the date.
mano-wii marked this conversation as resolved
@ -0,0 +56,4 @@
args = parser.parse_args()
username = args.username
if not username:
from weekly_report import git_username_detect

Perhaps would make more sense to add this in gitea_utils since a dependency on the weekly reports script is not so obvious.

Perhaps would make more sense to add this in `gitea_utils` since a dependency on the weekly reports script is not so obvious.
mano-wii marked this conversation as resolved
@ -0,0 +266,4 @@
start_date = end_date - datetime.timedelta(days=time_delta, hours=end_date.hour)
# Ensure friday :)
firday = start_date + datetime.timedelta(days=4)

Typo: firday -> friday

Typo: firday -> friday
mano-wii marked this conversation as resolved
Author
Member

Thanks for the feedback @brecht

In addition to what was suggested, I also created the url_json_get_all_pages function that uses the limit param.
Unfortunately in some cases the page and limit parameters fail when the page is 1. So they could not be used.

I also left the imports os and subprocess inside the git_username_detect function, as this function, besides not being a Gitea utility, is a bit of a workaround and therefore is treated differently.

Thanks for the feedback @brecht In addition to what was suggested, I also created the `url_json_get_all_pages` function that uses the `limit` param. Unfortunately in some cases the `page` and `limit` parameters fail when the page is 1. So they could not be used. I also left the imports `os` and `subprocess` inside the `git_username_detect` function, as this function, besides not being a Gitea utility, is a bit of a workaround and therefore is treated differently.
Brecht Van Lommel approved these changes 2023-08-01 22:41:04 +02:00
@ -0,0 +190,4 @@
# WORKAROUND: This function doesn't involve Gitea, and the obtained username may not match the username used in Gitea.
# However, it provides an option to fetch the configured username from the local Git,
# in case the user does not explicitly supply the username.
# Please note that this approach may not be suitable for all scenarios and might not be secure in some cases.

I'm not sure what is insecure about this? Would leave that out unless there is a good reason.

I'm not sure what is insecure about this? Would leave that out unless there is a good reason.
mano-wii marked this conversation as resolved
Germano Cavalcante force-pushed weekly_report_generator from 2bec691eec to 6e98c3e64b 2023-08-04 19:26:53 +02:00 Compare
Germano Cavalcante merged commit b6ed70cd92 into main 2023-08-04 19:32:31 +02:00
Germano Cavalcante deleted branch weekly_report_generator 2023-08-04 19:32:33 +02:00
Member

Thx working on this! (wasnt able to review because I was on holidays)

I will add --calendarweek as an arg (as we discussed) and put up a PR for that

Thx working on this! (wasnt able to review because I was on holidays) I will add `--calendarweek` as an arg (as we discussed) and put up a PR for that
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110652
No description provided.