airflow.contrib.operators.pubsub_operator
¶
Module Contents¶
-
class
airflow.contrib.operators.pubsub_operator.
PubSubTopicCreateOperator
(project, topic, fail_if_exists=False, gcp_conn_id='google_cloud_default', delegate_to=None, *args, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Create a PubSub topic.
By default, if the topic already exists, this operator will not cause the DAG to fail.
The operator can be configured to fail if the topic already exists.
Both
project
andtopic
are templated so you can use variables in them.
-
class
airflow.contrib.operators.pubsub_operator.
PubSubSubscriptionCreateOperator
(topic_project, topic, subscription=None, subscription_project=None, ack_deadline_secs=10, fail_if_exists=False, gcp_conn_id='google_cloud_default', delegate_to=None, *args, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Create a PubSub subscription.
By default, the subscription will be created in
topic_project
. Ifsubscription_project
is specified and the GCP credentials allow, the Subscription can be created in a different project from its topic.By default, if the subscription already exists, this operator will not cause the DAG to fail. However, the topic must exist in the project.
The operator can be configured to fail if the subscription already exists.
Finally, subscription is not required. If not passed, the operator will generated a universally unique identifier for the subscription’s name.
topic_project
,topic
,subscription
, andsubscription
are templated so you can use variables in them.
-
class
airflow.contrib.operators.pubsub_operator.
PubSubTopicDeleteOperator
(project, topic, fail_if_not_exists=False, gcp_conn_id='google_cloud_default', delegate_to=None, *args, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Delete a PubSub topic.
By default, if the topic does not exist, this operator will not cause the DAG to fail.
The operator can be configured to fail if the topic does not exist.
Both
project
andtopic
are templated so you can use variables in them.
-
class
airflow.contrib.operators.pubsub_operator.
PubSubSubscriptionDeleteOperator
(project, subscription, fail_if_not_exists=False, gcp_conn_id='google_cloud_default', delegate_to=None, *args, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Delete a PubSub subscription.
By default, if the subscription does not exist, this operator will not cause the DAG to fail.
The operator can be configured to fail if the subscription already exists.
project
, andsubscription
are templated so you can use variables in them.
-
class
airflow.contrib.operators.pubsub_operator.
PubSubPublishOperator
(project, topic, messages, gcp_conn_id='google_cloud_default', delegate_to=None, *args, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Publish messages to a PubSub topic.
Each Task publishes all provided messages to the same topic in a single GCP project. If the topic does not exist, this task will fail.
project
,topic
, andmessages
are templated so you can use variables in them.