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

Enable asynchronous job submission in BigQuery Insert Job #21385

Merged
merged 8 commits into from
Feb 11, 2022

Conversation

phanikumv
Copy link
Contributor

@phanikumv phanikumv commented Feb 7, 2022

  • Add nowait flag to the insert_job method
  • When nowait is True, the execution won't wait till the job results are available.
  • By default, the job execution will wait till job results are available.

cc @dstandish @kaxil


^ 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.

Copy link
Contributor

@dstandish dstandish left a comment

Choose a reason for hiding this comment

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

@phanikumv I think we should return {"job_id": self.job_id} from execute so it could be used in a sensor. can you do that and add a test for that behavoir?
thanks

tests/providers/google/cloud/hooks/test_bigquery.py Outdated Show resolved Hide resolved
@dstandish
Copy link
Contributor

@phanikumv I think we should return {"job_id": self.job_id} from execute so it could be used in a sensor. can you do that and add a test for that behavoir?
thanks

disregard; i was looking at wrong operator in the file; it's already returning job id

Copy link
Contributor

@dstandish dstandish left a comment

Choose a reason for hiding this comment

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

everything looks good except i would just ask that you rename is_async as suggested in the other comment.

airflow/providers/google/cloud/hooks/bigquery.py Outdated Show resolved Hide resolved
airflow/providers/google/cloud/hooks/bigquery.py Outdated Show resolved Hide resolved
Copy link
Contributor

@dstandish dstandish left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Feb 10, 2022
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

phanikumv and others added 8 commits February 10, 2022 09:11
- Add is_async flag to the insert_job method
- When is_async is True, the execution won't wait till the job results are available.
- By default, the job execution will wait till job results are available.
- Pass is_async flag through a pytest fixture with True or False values
- Modify test_insert_job method to accept is_async as parameter
- Change is_async flag from Optional[bool] to bool
- Add is_async flag to the insert_job method
- When is_async is True, the execution won't wait till the job results are available.
- By default, the job execution will wait till job results are available.
@lwyszomi
Copy link
Contributor

@phanikumv why this nowait parameter was added only to the hook, now we don't have possibility to use it in BigQueryInsertJobOperator.

@phanikumv
Copy link
Contributor Author

@lwyszomi my thought process was that for async job execution requirements, we can make use of the BigQueryInsertJobOperatorAsync , which executes the insert_job method with nowait set to True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants