airflow.providers.google.cloud.operators.tasks
¶
This module contains various Google Cloud Tasks operators which allow you to perform basic operations using Cloud Tasks queues/tasks.
Module Contents¶
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueueCreateOperator
(*, location: str, task_queue: Queue, project_id: Optional[str] = None, queue_name: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Creates a queue in Cloud Tasks.
- Parameters
location (str) -- The location name in which the queue will be created.
task_queue (dict or google.cloud.tasks_v2.types.Queue) -- The task queue to create. Queue's name cannot be the same as an existing queue. If a dict is provided, it must be of the same form as the protobuf message Queue.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
queue_name (str) -- (Optional) The queue's name. If provided, it will be used to construct the full queue path.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueueUpdateOperator
(*, task_queue: Queue, project_id: Optional[str] = None, location: Optional[str] = None, queue_name: Optional[str] = None, update_mask: Union[Dict, FieldMask] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Updates a queue in Cloud Tasks.
- Parameters
task_queue (dict or google.cloud.tasks_v2.types.Queue) -- The task queue to update. This method creates the queue if it does not exist and updates the queue if it does exist. The queue's name must be specified.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
location (str) -- (Optional) The location name in which the queue will be updated. If provided, it will be used to construct the full queue path.
queue_name (str) -- (Optional) The queue's name. If provided, it will be used to construct the full queue path.
update_mask (dict or google.cloud.tasks_v2.types.FieldMask) -- A mast used to specify which fields of the queue are being updated. If empty, then all fields will be updated. If a dict is provided, it must be of the same form as the protobuf message.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueueGetOperator
(*, location: str, queue_name: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Gets a queue from Cloud Tasks.
- Parameters
location (str) -- The location name in which the queue was created.
queue_name (str) -- The queue's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueuesListOperator
(*, location: str, project_id: Optional[str] = None, results_filter: Optional[str] = None, page_size: Optional[int] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Lists queues from Cloud Tasks.
- Parameters
location (str) -- The location name in which the queues were created.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
results_filter (str) -- (Optional) Filter used to specify a subset of queues.
page_size (int) -- (Optional) The maximum number of resources contained in the underlying API response.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueueDeleteOperator
(*, location: str, queue_name: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Deletes a queue from Cloud Tasks, even if it has tasks in it.
- Parameters
location (str) -- The location name in which the queue will be deleted.
queue_name (str) -- The queue's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueuePurgeOperator
(*, location: str, queue_name: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Purges a queue by deleting all of its tasks from Cloud Tasks.
- Parameters
location (str) -- The location name in which the queue will be purged.
queue_name (str) -- The queue's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueuePauseOperator
(*, location: str, queue_name: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Pauses a queue in Cloud Tasks.
- Parameters
location (str) -- The location name in which the queue will be paused.
queue_name (str) -- The queue's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksQueueResumeOperator
(*, location: str, queue_name: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Resumes a queue in Cloud Tasks.
- Parameters
location (str) -- The location name in which the queue will be resumed.
queue_name (str) -- The queue's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksTaskCreateOperator
(*, location: str, queue_name: str, task: Union[Dict, Task], project_id: Optional[str] = None, task_name: Optional[str] = None, response_view: Optional[enums.Task.View] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Creates a task in Cloud Tasks.
- Parameters
location (str) -- The location name in which the task will be created.
queue_name (str) -- The queue's name.
task (dict or google.cloud.tasks_v2.types.Task) -- The task to add. If a dict is provided, it must be of the same form as the protobuf message Task.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
task_name (str) -- (Optional) The task's name. If provided, it will be used to construct the full task path.
response_view (google.cloud.tasks_v2.enums.Task.View) -- (Optional) This field specifies which subset of the Task will be returned.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksTaskGetOperator
(*, location: str, queue_name: str, task_name: str, project_id: Optional[str] = None, response_view: Optional[enums.Task.View] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Gets a task from Cloud Tasks.
- Parameters
location (str) -- The location name in which the task was created.
queue_name (str) -- The queue's name.
task_name (str) -- The task's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
response_view (google.cloud.tasks_v2.enums.Task.View) -- (Optional) This field specifies which subset of the Task will be returned.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksTasksListOperator
(*, location: str, queue_name: str, project_id: Optional[str] = None, response_view: Optional[enums.Task.View] = None, page_size: Optional[int] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Lists the tasks in Cloud Tasks.
- Parameters
location (str) -- The location name in which the tasks were created.
queue_name (str) -- The queue's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
response_view (google.cloud.tasks_v2.enums.Task.View) -- (Optional) This field specifies which subset of the Task will be returned.
page_size (int) -- (Optional) The maximum number of resources contained in the underlying API response.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksTaskDeleteOperator
(*, location: str, queue_name: str, task_name: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Deletes a task from Cloud Tasks.
- Parameters
location (str) -- The location name in which the task will be deleted.
queue_name (str) -- The queue's name.
task_name (str) -- The task's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
-
class
airflow.providers.google.cloud.operators.tasks.
CloudTasksTaskRunOperator
(*, location: str, queue_name: str, task_name: str, project_id: Optional[str] = None, response_view: Optional[enums.Task.View] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[MetaData] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Forces to run a task in Cloud Tasks.
- Parameters
location (str) -- The location name in which the task was created.
queue_name (str) -- The queue's name.
task_name (str) -- The task's name.
project_id (str) -- (Optional) The ID of the Google Cloud project that owns the Cloud Tasks. If set to None or missing, the default project_id from the Google Cloud connection is used.
response_view (google.cloud.tasks_v2.enums.Task.View) -- (Optional) This field specifies which subset of the Task will be returned.
retry (google.api_core.retry.Retry) -- (Optional) A retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float) -- (Optional) The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.
metadata (sequence[tuple[str, str]]]) -- (Optional) Additional metadata that is provided to the method.
gcp_conn_id (str) -- (Optional) The connection ID used to connect to Google Cloud.
impersonation_chain (Union[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).
- Return type