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 CloudRunExecuteJobOperator #28525

Conversation

VinceLegendre
Copy link

@VinceLegendre VinceLegendre commented Dec 21, 2022

This operator aims at executing existing Cloud Run jobs, with the same design philosophy as the DataflowStartFlexTemplateOperator.

  • CloudRunExecuteJobOperator extends the BaseOperator
  • CloudRunJobHook extends the GoogleBaseHook, to easily manage authentication and project_id fallback
  • CloudRunJobLink andCloudRunJobExecutionLink extend the BaseGoogleLink

Closes: #24730

@boring-cyborg
Copy link

boring-cyborg bot commented Dec 21, 2022

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)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy 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://s.apache.org/airflow-slack

@VinceLegendre VinceLegendre changed the title Add CloudRunExecuteJobOperator and required dependencies Add CloudRunExecuteJobOperator Dec 21, 2022
@VinceLegendre VinceLegendre mentioned this pull request Dec 22, 2022
2 tasks
@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch 2 times, most recently from 2c8fce5 to 20bfa7b Compare December 29, 2022 11:16
@VinceLegendre VinceLegendre requested review from Taragolis and removed request for turbaszek and mik-laj December 29, 2022 16:49
@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch from 20bfa7b to 48eed2e Compare January 2, 2023 09:12
Comment on lines 167 to 188
def get_conn(self) -> build:
"""Returns a Google Cloud Run service object."""
http_authorized = self._authorize()

# Use a regional endpoint since job execution is not possible from the global endpoint
client_options = ClientOptions(api_endpoint=f'https://{self.region}-run.googleapis.com')
return build('run', 'v1', client_options=client_options,
http=http_authorized, cache_discovery=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

+1, the v2 API and its Python client libraries should be much easier to use.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @lwyszomi @steren

Cannot install the python client library (google-cloud-run>=0.7.0) as it breaks other dependencies requirements.
Happy to use the JobsClient if we manage to install google-cloud-run library

Copy link
Author

Choose a reason for hiding this comment

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

@Taragolis would you have an idea of how to fix this?

If using the official Python Client and implementing all the CRUD operations on jobs are completion requirements for this PR, we should mark this PR as draft for the time being.

Copy link
Author

Choose a reason for hiding this comment

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

FYI Completion requirements were discussed in this issue : #24730.

Maybe we could consider all the Jobs CRUD operations in a later PR, when the official JobsClient can be installed properly?

Opened to suggestions here 😉

@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch 3 times, most recently from 104d1ef to 420c506 Compare February 16, 2023 15:45
@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch from 420c506 to fabda1d Compare February 17, 2023 17:35
Copy link
Contributor

@Taragolis Taragolis left a comment

Choose a reason for hiding this comment

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

Approve in advance (need to resolve doc spellcheck)

I'm not familiar with GCP, for me looks nice. So would be nice if someone else review it

@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch from fabda1d to 2a95a05 Compare February 18, 2023 11:38
@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch from 2a95a05 to d2a90cc Compare February 18, 2023 13:58
@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch 2 times, most recently from ab3e06e to c58f4a0 Compare February 23, 2023 14:29
@eladkal
Copy link
Contributor

eladkal commented Mar 9, 2023

tests are failing :(

@eladkal
Copy link
Contributor

eladkal commented Mar 9, 2023

I'm assuming that by merging this PR we won't need #27638 ?

@alexshires
Copy link
Contributor

I'm assuming that by merging this PR we won't need #27638 ?

CloudRun is a container hosting service and CloudRunJobs are a job-based container execution version of that - IMO, we would need both sets of operators in Airflow to support both functionalities

@VinceLegendre
Copy link
Author

I'll try to fix tests in the coming days.

@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch 2 times, most recently from 7265c97 to 334efe5 Compare April 4, 2023 14:15
@VinceLegendre
Copy link
Author

Tests should be fixed now @eladkal .
Waiting for approvals to run all tests

@potiuk
Copy link
Member

potiuk commented Apr 7, 2023

Tests should be fixed now @eladkal . Waiting for approvals to run all tests

approved

@VinceLegendre
Copy link
Author

Looks like the failing test is not related to my implementation. I believe I should wait for a fix and rebase my branch from time to time?

@VinceLegendre VinceLegendre force-pushed the add_google_cloud_run_execute_job_operator branch from 334efe5 to 7f19415 Compare April 11, 2023 08:16
@VinceLegendre
Copy link
Author

Checks seem ok (appart from 9 skipped) @eladkal 🙂
Is there a further step to approve these changes? Should I look for additional reviewers in the community?

@eladkal
Copy link
Contributor

eladkal commented Apr 17, 2023

Is there a further step to approve these changes? Should I look for additional reviewers in the community?

waiting for your comment on #28525 (comment)

@eladkal
Copy link
Contributor

eladkal commented May 21, 2023

@VinceLegendre We bumped many google packages #30067
Can you please recheck and comment on #28525 (comment) if there is still a reason not to use V2?

@eladkal eladkal mentioned this pull request May 21, 2023
2 tasks
- New hook : CloudRunJobHook
- New links : CloudRunJobLink and CloudRunJobExecutionLinks
- New operator : CloudRunExecuteJobOperator
- According tests
- Documentation and examples
@potiuk potiuk force-pushed the add_google_cloud_run_execute_job_operator branch from 7f19415 to 587504e Compare May 21, 2023 15:01
@potiuk
Copy link
Member

potiuk commented May 21, 2023

I just rebased it to see if it works after recent upgrade of deps. I don't think there will be a big problem, It does not use any of the google client specific libraries - but the discovery client, so it should be fine as-is.

@potiuk
Copy link
Member

potiuk commented May 22, 2023

I just rebased it to see if it works after recent upgrade of deps. I don't think there will be a big problem, It does not use any of the google client specific libraries - but the discovery client, so it should be fine as-is.

However. I think indeed. it would be better to use the actual cloud run client rather than discovery one now. It should be possible now, after all the dependencies are updated, So the reason why discovery client was used here is gone. @VinceLegendre ?

@VinceLegendre
Copy link
Author

@potiuk @eladkal I think we should switch to the official client too.

Currently away from work for two weeks, I can try to work on it when I get back.

If this is urgent matter, please feel free to initiate new developments and I'll be happy to contribute 🙂

@potiuk
Copy link
Member

potiuk commented May 22, 2023

No worries. It can wait

@eladkal
Copy link
Contributor

eladkal commented Jun 2, 2023

@potiuk @eladkal I think we should switch to the official client too.

Cool! please ping me when ready for review

@eladkal
Copy link
Contributor

eladkal commented Jun 30, 2023

Hi @VinceLegendre checking if you still plan to make the changes?

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Aug 15, 2023
@github-actions github-actions bot closed this Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers area:system-tests kind:documentation provider:google Google (including GCP) related issues stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google CloudRun job operator
8 participants