-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Add a couple DAG bundle related helpers #45339
Conversation
@jedcunningham - can you please rebase that one -> we found and issue with @jscheffl with the new caching scheme - fixed in #45347 that would run "main" version of the tests. I am asking in all affected PRs to rebase. |
ca0b0ab
to
5357956
Compare
This is broken out of the larger changes adding DAG bundle parsing, to make reviewing that (eventual) PR a bit easier.
327c909
to
c0cf936
Compare
@@ -770,6 +770,16 @@ def get_is_paused(self, session=NEW_SESSION) -> None: | |||
"""Return a boolean indicating whether this DAG is paused.""" | |||
return session.scalar(select(DagModel.is_paused).where(DagModel.dag_id == self.dag_id)) | |||
|
|||
@provide_session | |||
def get_bundle_name(self, session=NEW_SESSION) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to be None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could if the DAG is not synced into the db. This one and get_latest_bundle_version
should have the same return type (either both str
or both str | None
), and if it’s to return str
, it should use scalars(...).one()
instead to raise an exception when there’s no matching entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible right now - yes. Possible next week, no :)
For now bundle is nullable in the db, but that's on my list and very near the top.
The PR these were split out of is already merged, so I actually need to close this PR. But I'll open one to do a little cleanup on these methods. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is that cleanup PR, #45672. I've left it returning None and will tackle the retyping it later this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, but there's conflict we might need to resolve and would love to know if it's possible for us to add test cases for this. Thanks!
This is broken out of the larger changes adding DAG bundle parsing, to make reviewing that (eventual) PR a bit easier.