-
Notifications
You must be signed in to change notification settings - Fork 16.4k
In DAG dependency detector, use class type instead of class name, related #19582 #19683
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
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
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.
Since this is done during serialization time this should be ok, however can you please add test(s)
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.
Sure I'll look into how tests work in airflow, and add one, I suppose, for testing that both TriggerDagRunOperator and inherited classes give the expected result.
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.
@kaxil do you think that perhaps there should be an attribute on task sensor (like a class attribute that is set on it, and which could also be set in other implementations) that we look at (instead of the class itself) so that there could be other implementations of task-sensor-like operators which do not inherit from external task sensor but also have dag dependencies?
so that it needn't necessarily be a subclass. maybe it's a bit too magical, and just thinking aloud, but perhaps we could look at the arguments of the operator to infer whether DagDependency should be created?
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.
Looks good, can you fix Static Checks please https://github.com/apache/airflow/runs/4281700481?check_suite_focus=true and rebase on latest main branch please.
|
Is that purely formatting / style? I should be able to fix that (but so should the automatic checking I suppose?). |
17bcf7f to
0311d86
Compare
dstandish
left a comment
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.
i think this looks ok but just have some naming nits
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.
| for Trigger in [TriggerDagRunOperator, DerivedTrigger]: | |
| for class_ in [TriggerDagRunOperator, DerivedTrigger]: |
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.
@kaxil do you think that perhaps there should be an attribute on task sensor (like a class attribute that is set on it, and which could also be set in other implementations) that we look at (instead of the class itself) so that there could be other implementations of task-sensor-like operators which do not inherit from external task sensor but also have dag dependencies?
so that it needn't necessarily be a subclass. maybe it's a bit too magical, and just thinking aloud, but perhaps we could look at the arguments of the operator to infer whether DagDependency should be created?
|
bump |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Add tests for DAG dependency detector Adhere to style norms Add a line to make black happy Don't call an Operator just Trigger Use `class_` for class variables Fix static check isort imports Simplipy test class and split into two tests
fa44c31 to
1e3ad5d
Compare
This small PR uses the type of a
BaseOperatortask, rather than its propertytask_type, to detect DAG dependence.This helps in situations like described in #19582, where an operator is derived from
ExternalTaskSensor. Using thetask_typeprevents such a sensor from being detected as a DAG dependence. This PR will allow automatic detection of derived classes.