Scale, up or down, a cluster on Google Cloud Dataproc. The operator will wait until the cluster is re-scaled.

View Source

Last Updated: May. 7, 2021

Access Instructions

Install the Google provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.


cluster_namestrThe name of the cluster to scale. (templated)
project_idstrThe ID of the google cloud project in which the cluster runs. (templated)
regionstrThe region for the dataproc cluster. (templated)
num_workersintThe new number of workers
num_preemptible_workersintThe new number of preemptible workers
graceful_decommission_timeoutstrTimeout for graceful YARN decommissioning. Maximum value is 1d
gcp_conn_idstrThe connection ID to use connecting to Google Cloud.
impersonation_chainUnion[str, Sequence[str]]Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).


Scale, up or down, a cluster on Google Cloud Dataproc. The operator will wait until the cluster is re-scaled.


t1 = DataprocClusterScaleOperator(

See also

For more detail on about scaling clusters have a look at the reference:

Example DAGs

Improve this module by creating an example DAG.

View Source
  1. Add an `example_dags` directory to the top-level source of the provider package with an empty `` file.
  2. Add your DAG to this directory. Be sure to include a well-written and descriptive docstring
  3. Create a pull request against the source code. Once the package gets released, your DAG will show up on the Registry.

Was this page helpful?