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

force DagModel to use joined eager load #11

Closed
wants to merge 1 commit into from

Conversation

shinny-taojiachun
Copy link
Collaborator

@shinny-taojiachun shinny-taojiachun commented May 14, 2024

背景

#6 修复了部分dagmodel的懒加载问题,但是webserver侧flask加载dagmodel又出现了问题
image

方案

将所有DadModel类中的懒加载全部关闭,采用joined eager loading

Summary by CodeRabbit

  • 性能优化
    • 优化了多个关系的加载方式,提高了应用的性能和响应速度。

Copy link

coderabbitai bot commented May 14, 2024

Walkthrough

Walkthrough

这次修改主要集中在airflow/models/dag.py文件中的DagModel类。通过在多个关系声明中添加lazy="joined",优化了数据加载策略,以提高性能和效率。

Changes

文件路径 变更摘要
airflow/models/dag.py DagModel类的多个关系声明中添加了lazy="joined"

🐇✨

代码如春风,优化心中留,

数据关系巧安排,性能更上楼。

懒加载如流水,效率自然高,

DAG模型新改动,兔子也欢笑。


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between dd61bf6 and 16ee647.
Files selected for processing (1)
  • airflow/models/dag.py (3 hunks)
Additional comments not posted (5)
airflow/models/dag.py (5)

3036-3036: 检查 DagTag 类的 tags 关系定义是否正确。


3039-3039: 检查 DagOwnerAttributes 类的 dag_owner_links 关系定义是否正确。


3064-3064: 检查 DagModel 类中的 parent_dag 关系定义是否正确。


3069-3069: 检查 DagModel 类中的 schedule_dataset_references 关系定义是否正确。


3075-3075: 检查 DagModel 类中的 task_outlet_dataset_references 关系定义是否正确。

@shinny-taojiachun
Copy link
Collaborator Author

shinny-taojiachun commented May 14, 2024

根因不是来自session,而是dagcode被意外删除了。
#12 提出了新的修复方案

踩坑记录

  • 此处的报错非常不直观,DagcodeNotFound 错误被吃掉了
  • session的生命周期管理出现了问题导致页面渲染出错没有正确反馈出问题

@shinny-taojiachun shinny-taojiachun deleted the fix-dagmodel-lazyloading branch May 14, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant