airflow.providers.google.cloud.operators.cloud_batch

Module Contents

Classes

CloudBatchSubmitJobOperator

Submit a job and wait for its completion.

CloudBatchDeleteJobOperator

Deletes a job and wait for the operation to be completed.

CloudBatchListJobsOperator

List Cloud Batch jobs.

CloudBatchListTasksOperator

List Cloud Batch tasks for a given job.

class airflow.providers.google.cloud.operators.cloud_batch.CloudBatchSubmitJobOperator(project_id, region, job_name, job, polling_period_seconds=10, timeout_seconds=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Submit a job and wait for its completion.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • job_name (str) – Required. The name of the job to create.

  • job (dict | google.cloud.batch_v1.Job) – Required. The job descriptor containing the configuration of the job to submit.

  • polling_period_seconds (float) – Optional: Control the rate of the poll for the result of deferrable run. By default, the trigger will poll every 10 seconds.

  • timeout – The timeout for this request.

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud.

  • impersonation_chain (str | Sequence[str] | None) – 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).

  • deferrable (bool) – Run operator in the deferrable mode

template_fields = ('project_id', 'region', 'gcp_conn_id', 'impersonation_chain', 'job_name')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event)[source]
class airflow.providers.google.cloud.operators.cloud_batch.CloudBatchDeleteJobOperator(project_id, region, job_name, timeout=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Deletes a job and wait for the operation to be completed.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • job_name (str) – Required. The name of the job to be deleted.

  • timeout (float | None) – The timeout for this request.

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud.

  • impersonation_chain (str | Sequence[str] | None) – 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).

template_fields = ('project_id', 'region', 'gcp_conn_id', 'impersonation_chain', 'job_name')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.cloud_batch.CloudBatchListJobsOperator(project_id, region, gcp_conn_id='google_cloud_default', filter=None, limit=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

List Cloud Batch jobs.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud.

  • filter (str | None) – The filter based on which to list the jobs. If left empty, all the jobs are listed.

  • limit (int | None) – The number of jobs to list. If left empty, all the jobs matching the filter will be returned.

  • impersonation_chain (str | Sequence[str] | None) – 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).

template_fields = ('project_id', 'region', 'gcp_conn_id', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.cloud_batch.CloudBatchListTasksOperator(project_id, region, job_name, gcp_conn_id='google_cloud_default', impersonation_chain=None, group_name='group0', filter=None, limit=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

List Cloud Batch tasks for a given job.

Parameters
  • project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.

  • region (str) – Required. The ID of the Google Cloud region that the service belongs to.

  • job_name (str) – Required. The name of the job for which to list tasks.

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud.

  • filter (str | None) – The filter based on which to list the jobs. If left empty, all the jobs are listed.

  • group_name (str) – The name of the group that owns the task. By default it’s group0.

  • limit (int | None) – The number of tasks to list. If left empty, all the tasks matching the filter will be returned.

  • impersonation_chain (str | Sequence[str] | None) – 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).

template_fields = ('project_id', 'region', 'job_name', 'gcp_conn_id', 'impersonation_chain', 'group_name')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?