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

Add extra links for google dataproc #10343

Merged
merged 17 commits into from
May 7, 2021

Conversation

yesemsanthoshkumar
Copy link
Contributor

@yesemsanthoshkumar yesemsanthoshkumar commented Aug 15, 2020

Add extra links for google cloud operators - Dataproc

How it is implemented

  1. DataprocOperator pushes the details to xcom
  2. The value pushed into Xcom is fetched to construct the link for job

Note: I haven't worked with dataproc workflows so I haven't implemented links for WorkFlow related operators.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

@boring-cyborg boring-cyborg bot added the provider:google Google (including GCP) related issues label Aug 15, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 15, 2020

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/master/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://apache-airflow-slack.herokuapp.com/

@yesemsanthoshkumar yesemsanthoshkumar marked this pull request as draft August 15, 2020 14:43
@yesemsanthoshkumar
Copy link
Contributor Author

@mik-laj
I've added extra link for dataproc jobs.

However, I've the following questions.

  1. While running the pre-commit hooks, I see both pylint and fake8 running checks. I've marked both of them to disable line too long error for some lines inside the files. Why do we have both of them?
  2. I'm directing the link to the cluster if the job hasn't run and not generated any JobId. Is this approach valid? Do you want me to change this behaviour?
  3. I coudn't find the cluster_name argument in DataprocSubmitJobOperator for which I've added the links. Shoud I add the links to DataprocJobBaseOperator? Or Should I add on both?

@@ -590,7 +681,7 @@ def test_execute(self, mock_hook, mock_uuid):
query=self.query,
variables=self.variables,
)
op.execute(context={})
op.execute(context=MagicMock())
Copy link
Member

Choose a reason for hiding this comment

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

I suppose you did this because of adding xcom_push in execute, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added a mock task instance for testing the xcom push. This change is regarding the operator extra links. Please take a look at the updated tests.

Copy link
Member

@turbaszek turbaszek left a comment

Choose a reason for hiding this comment

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

We should also add the console link to

BUILTIN_OPERATOR_EXTRA_LINKS: List[str] = [
"airflow.providers.google.cloud.operators.bigquery.BigQueryConsoleLink",
"airflow.providers.google.cloud.operators.bigquery.BigQueryConsoleIndexableLink",
"airflow.providers.google.cloud.operators.mlengine.AIPlatformConsoleLink",
"airflow.providers.qubole.operators.qubole.QDSLink"
]

And as mentioned in a comment - we should add the link in DataprocSubmitJobOperator as other ops are deprecated. So, we may even consider to add this only to this one operator 😉

@yesemsanthoshkumar
Copy link
Contributor Author

We should also add the console link to

BUILTIN_OPERATOR_EXTRA_LINKS: List[str] = [
"airflow.providers.google.cloud.operators.bigquery.BigQueryConsoleLink",
"airflow.providers.google.cloud.operators.bigquery.BigQueryConsoleIndexableLink",
"airflow.providers.google.cloud.operators.mlengine.AIPlatformConsoleLink",
"airflow.providers.qubole.operators.qubole.QDSLink"
]

And as mentioned in a comment - we should add the link in DataprocSubmitJobOperator as other ops are deprecated. So, we may even consider to add this only to this one operator 😉

@turbaszek I've added to those other operator as well already.
:D

@yesemsanthoshkumar
Copy link
Contributor Author

@mik-laj

  1. I'm directing the link to the cluster if the job hasn't run and not generated any JobId. Is this approach valid? Do you want me to change this behaviour?

The link is not being redirected to the cluster URL if there is no detail of the job in the system.

  1. I coudn't find the cluster_name argument in DataprocSubmitJobOperator for which I've added the links. Shoud I add the links to DataprocJobBaseOperator? Or Should I add on both?

Implemented on both the operators. For subclasses of DataprocJobBaseOperators, I've added tests only for DataprocSubmitSparkJob operator as the other operators are anyway deprecated. Please have a look at the above comments by @turbaszek regarding this.

@yesemsanthoshkumar yesemsanthoshkumar marked this pull request as ready for review August 18, 2020 14:34
@yesemsanthoshkumar yesemsanthoshkumar changed the title [WIP] Add extra links for google dataproc Add extra links for google dataproc Aug 18, 2020
Copy link
Member

@turbaszek turbaszek left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@turbaszek turbaszek requested a review from mik-laj August 22, 2020 19:26
@turbaszek
Copy link
Member

@yesemsanthoshkumar can you please rebase? We started using black on providers package 👍

@turbaszek
Copy link
Member

Nice to see this as part of #10014

@yesemsanthoshkumar yesemsanthoshkumar force-pushed the AI-9941-Dataproc branch 4 times, most recently from 5e772cb to 6364da7 Compare August 27, 2020 16:59
@turbaszek
Copy link
Member

Tested both links. This rocks! Thanks @yesemsanthoshkumar 🚀

@potiuk potiuk dismissed ashb’s stale review May 7, 2021 09:19

The quote changess were reverted :).

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label May 7, 2021
@github-actions
Copy link

github-actions bot commented May 7, 2021

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@potiuk potiuk merged commit b8c0fde into apache:master May 7, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented May 7, 2021

Awesome work, congrats on your first merged pull request!

@potiuk
Copy link
Member

potiuk commented May 7, 2021

Wooho! 🎉 -> took some time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full tests needed We need to run full set of tests for this PR to merge pinned Protect from Stalebot auto closing provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants