Deferrable support for HttpOperator #45228
Open
+153
−114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enabling deferrable for HttpOperator causes an error.
The minimum test case is as follows
For connections, set Connection Id to “google_http_default”, Connection Type to “HTTP” and HOST to “https://www.google.com”.
If you place it in airflow/files/dags/ and run it you will get the following error
Causes:.
https://github.com/apache/airflow/blob/9178f8f0b1ffd80b8eacf4d02b732528fde218e5/providers/src/airflow/providers/http/triggers/http .py#L97
A session object is created by the above caller.
It is at the following link
https://github.com/apache/airflow/blob/9178f8f0b1ffd80b8eacf4d02b732528fde218e5/providers/src/airflow/providers/http/hooks/http.py #L413
The following is then called.
https://github.com/apache/airflow/blob/9178f8f0b1ffd80b8eacf4d02b732528fde218e5/providers/src/airflow/providers/http/triggers/http .py#L103
https://github.com/apache/airflow/blob/9178f8f0b1ffd80b8eacf4d02b732528fde218e5/providers/src/airflow/providers/http/triggers/http .py#L117
It is expected that the ClientSession is alive at this point, but it is already out of scope and disconnected.
To properly correct this, we changed the configuration to the following Previously, the opposite was the case, which caused the bug.
Correct.
ClientSession scope {
ClientResponse scope{
response.read
}
}
Incorrect
ClientResponse scope {
ClientSession scope {
}
response.read expect session living (error)
}
With the interface changes, we modified the required tests, re-ran the required tests, and verified that they completed successfully. I would be happy to check and review! Best regards.
Takayuki Tanabe
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.