Conversation
|
/gemini review |
Summary of ChangesHello @LuisJG8, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Airflow DAG responsible for fetching GitHub data by introducing stateful tracking of the starting repository number using Airflow Variables. It also refactors the Celery application integration by importing it from the worker module and adjusts the worker's internal loop termination logic for data processing. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the Airflow DAG to manage repository processing state using Airflow Variables. While this is a good step, the review identifies some critical issues. There are unused imports that should be removed. More importantly, the pagination logic for fetching GitHub repositories is flawed and could lead to data loss or duplication. Additionally, the worker contains leftover debug code that prematurely terminates its execution. These issues need to be addressed to ensure the DAG runs correctly and reliably.
| start_with_repo_number = int(Variable.get("github_repo_number", default_var = "0")) | ||
| start_with_repo_number += 500 | ||
|
|
||
| print("celery_worker") | ||
| app.send_task("worker.get_github_data", kwargs={"start_in_repo_num": start_with_repo_number, "batch_size": 500}) | ||
|
|
||
| Variable.set(key= "github_repo_number", value= str(start_with_repo_number)) |
There was a problem hiding this comment.
The current logic for determining start_with_repo_number is flawed. It increments the value by a fixed batch_size (500) in each run. However, the worker task (get_github_data) does not return the ID of the last repository it processed. This can lead to skipping or reprocessing repositories, especially since the GitHub get_repos(since=...) API returns repositories with an ID greater than the provided value.
To fix this, the get_github_data task should return the ID of the last repository it processed. The DAG should then use this returned value (via XComs) to update the github_repo_number Airflow Variable for the next run.
| if counter >= 25: | ||
| break |
| from email.policy import default | ||
| import os | ||
| from socket import timeout | ||
| from tracemalloc import start |
There was a problem hiding this comment.
Code Review
This pull request updates the Airflow DAG to persist the starting repository number between runs using Airflow Variables, which is a good improvement for making the process stateful. It also includes changes to the Celery worker.
My review has identified a couple of issues:
- There are unused imports in the DAG file that should be removed for code cleanliness.
- A hardcoded limit has been introduced in the worker which appears to be leftover from debugging and will prevent it from processing full batches. This is a significant issue that needs to be addressed.
Please see the detailed comments below.
| if counter >= 25: | ||
| break |
There was a problem hiding this comment.
| from email.policy import default | ||
| import os | ||
| from socket import timeout | ||
| from tracemalloc import start |
No description provided.