-
Notifications
You must be signed in to change notification settings - Fork 16.3k
feat: implementation of BaseOperatorLink for cloud run jobs to expose the GCP cloud logging url #46911
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
feat: implementation of BaseOperatorLink for cloud run jobs to expose the GCP cloud logging url #46911
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 Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
b2d6790 to
1295e5b
Compare
… github.com:ramonvermeulen/airflow into feature/ramon/36963-cloud-run-jobs-operator-log-url
626d1dd to
9685f0b
Compare
9685f0b to
5c07ae6
Compare
|
@potiuk @amoghrajesh @sunank200 @eladkal Since I see that most of you are involved in decision making and recent contributions to the google-provider, and this is my first time contributing to airflow, I would love to hear your view/opinion on this feature. |
providers/google/src/airflow/providers/google/cloud/operators/cloud_run.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/operators/cloud_run.py
Outdated
Show resolved
Hide resolved
providers/google/src/airflow/providers/google/cloud/operators/cloud_run.py
Outdated
Show resolved
Hide resolved
… github.com:ramonvermeulen/airflow into feature/ramon/36963-cloud-run-jobs-operator-log-url
… github.com:ramonvermeulen/airflow into feature/ramon/36963-cloud-run-jobs-operator-log-url
5d17b3d to
fffcc52
Compare
ashb
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.
Rather than just putting this URL in the log message, please look at the "OperatorExtraLinks" concept -- you can make this show up as a button in the Airflow UI.
(They way I would suggest wiring that up is to have the operator push the url to XCom, and the OperatorLink can then pull the URL out of xcom)
Thanks, wasn't aware of that functionality. Will see if I can change the implementation after the weekend to make use of |
|
Weirdly tests fail and seem to hit these airflow 3 >= lines while being ran with 2.9.3 and 2.10.5?: |
Not weirdly - airflow.sdk does not existi in Airflow 2 and the test import it - so it fail, there needs to be compatibility code in the test to run also in Airflow 2. |
providers/google/tests/unit/google/cloud/links/test_cloud_run.py
Outdated
Show resolved
Hide resolved
amoghrajesh
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.
Preemptive approval once you have fixed the failing tests
Whoops, was fixated on the other test that already had the compatibility code. |
|
@ramonvermeulen i am going to merge this one once we get a green build. |
Can you clarify what else would be needed to fully solve the issue after this PR is merged? Should we close the original issue and open a new one on the specific task? |
What I mean with "partly" solves the issue is the following:
Therefore I created this PR, which partly solves the issue (at least gives a nice alternative). Instead of integrating the full cloud run job logs directly in Airflow, I added an extra link. With this extra link you can click on a button in the Airflow UI and get redirected to the logs in GCP of that exact cloud run job execution. Back to your question: To fully solve the issue (after this PR) a solution needs to be implemented (if it is possible) to show the full cloud run job container logs directly in the Airflow operator. |
So to allow dump of the remote job logs into the Airflow task like we do with AWS Glue?
|
Yes, something similar where the logs get fetched after completion via the logging API (or polled during job execution, but I think you will run into API limits even quicker). In the issue there is already an example provided, with a side note about the API limits. |
in some of AWS operators that store logs in cloud watch there is the option to set fetch interval airflow/providers/amazon/src/airflow/providers/amazon/aws/operators/ecs.py Lines 375 to 376 in cb295c3
but lets not discuss this here. The reason I mentioned this is to ask if you can comment on the issue and explain what is left to implement after we merge this PR so it will be clear to the developer who takes the task |
|
@ramonvermeulen can you rebase and resolve conflicts? |
Sure, that makes sense! I will give an update in the issue after the PR is merged 👍 |
New implementation (with extra_links) example:

^ 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.rstor{issue_number}.significant.rst, in newsfragments.