Skip to content

Add support for driver pool, instance flexibility policy, and min_num_instances for Dataproc #34172

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

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

ahzaz
Copy link
Contributor

@ahzaz ahzaz commented Sep 7, 2023


Add following to ClusterGenerator for Dataproc

  • min_num_workers: The minimum number of primary worker instances to create
  • driver_pool_size: The size of the cluster driver pool.
  • driver_pool_id: Custom identifier for the DRIVER Node Group being created.
  • secondary_worker_instance_flexibility_policy: Instance flexibility Policy allowing a mixture of VM shapes and provisioning models.
  • Upgrade google-cloud-dataproc to 5.5.0

@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Sep 7, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 7, 2023

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 (ruff, 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.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@ahzaz ahzaz force-pushed the dataproc-updates branch 2 times, most recently from 42e33bd to 0e87d7c Compare September 7, 2023 12:38
Copy link
Contributor

@SamWheating SamWheating left a comment

Choose a reason for hiding this comment

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

A couple suggestions

@ahzaz ahzaz force-pushed the dataproc-updates branch 5 times, most recently from 7da8f15 to 7c4dc41 Compare September 11, 2023 15:37
@ahzaz ahzaz requested a review from potiuk September 13, 2023 05:49
@ahzaz ahzaz requested a review from SamWheating September 14, 2023 08:56
@ahzaz ahzaz force-pushed the dataproc-updates branch 2 times, most recently from fee1497 to f2302aa Compare September 21, 2023 06:05
@ahzaz
Copy link
Contributor Author

ahzaz commented Sep 21, 2023

@potiuk @SamWheating Can you please review/approve the PR if there are no more concerns ?

Copy link
Contributor

@SamWheating SamWheating left a comment

Choose a reason for hiding this comment

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

A couple comments / suggestions

@@ -84,6 +117,7 @@ class ClusterGenerator:
to create the cluster. (templated)
:param num_workers: The # of workers to spin up. If set to zero will
spin up cluster in a single node mode
:param min_num_workers: The minimum number of primary worker instances to create.
Copy link
Contributor

Choose a reason for hiding this comment

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

Its not immediately clear how this value interacts with num_workers, might be worth elaborating a bit more?

From the API docs:

Example: Cluster creation request with num_instances = 5 and min_num_instances = 3:

If 4 VMs are created and 1 instance fails, the failed VM is deleted. The cluster is resized to 4 instances and placed in a RUNNING state.
If 2 instances are created and 3 instances fail, the cluster in placed in an ERROR state. The failed VMs are not deleted.

Could we add some of that context here? I don't have any strong opinions on the exact wording.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@@ -344,6 +402,10 @@ def _build_cluster_data(self):
"autoscaling_config": {},
"endpoint_config": {},
}

if self.min_num_workers:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we raise an Exception at initialization time if min_num_workers > num_workers?

It's usually best to surface issues as early as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

driver_pool = {
"node_group": {
"roles": ["DRIVER"],
"node_group_config": {"num_instances": self.driver_pool_size},
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on allowing instance type here as well? Something like:

Suggested change
"node_group_config": {"num_instances": self.driver_pool_size},
"node_group_config": {
"num_instances": self.driver_pool_size
"machine_type_uri": self.driver_pool_machine_type
},

Maybe this is too much config though? I'm fine with leaving this for another day.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let keep it these two for now. Later on, we can driver pool config (like InstanceFlexibilityPolicy) to cover rest of the config options.

@ahzaz ahzaz force-pushed the dataproc-updates branch 2 times, most recently from 06cf8f9 to 9c36945 Compare September 26, 2023 09:05
@ahzaz
Copy link
Contributor Author

ahzaz commented Sep 27, 2023

@SamWheating Thank you for review. Can you please trigger the workflow?

@SamWheating
Copy link
Contributor

I actually can't trigger the workflow - we'll have to wait for a committer to come along and do the final check + merge.

@ahzaz
Copy link
Contributor Author

ahzaz commented Oct 6, 2023

@potiuk Can you please help get this merged?

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.

Looks good.

@ahzaz
Copy link
Contributor Author

ahzaz commented Nov 15, 2023

@Taragolis Can you please help merge this.

@potiuk potiuk merged commit 08d15d0 into apache:main Nov 16, 2023
Copy link

boring-cyborg bot commented Nov 16, 2023

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

potiuk added a commit to potiuk/airflow that referenced this pull request Nov 16, 2023
The change in apache#34172 had been merged without rebasing and caused
static check failure in main.

This PR fixes it.
potiuk added a commit that referenced this pull request Nov 16, 2023
The change in #34172 had been merged without rebasing and caused
static check failure in main.

This PR fixes it.
@ephraimbuddy ephraimbuddy added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Nov 20, 2023
@ephraimbuddy ephraimbuddy added this to the Airflow 2.8.0 milestone Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants