Skip to content
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

Add guide for DataprocInstantiateInlineWorkflowTemplateOperator #22062

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
DataprocDeleteBatchOperator,
DataprocDeleteClusterOperator,
DataprocGetBatchOperator,
DataprocInstantiateInlineWorkflowTemplateOperator,
DataprocInstantiateWorkflowTemplateOperator,
DataprocListBatchesOperator,
DataprocSubmitJobOperator,
Expand Down Expand Up @@ -256,6 +257,12 @@
)
# [END how_to_cloud_dataproc_trigger_workflow_template]

# [START how_to_cloud_dataproc_instantiate_inline_workflow_template]
instantiate_inline_workflow_template = DataprocInstantiateInlineWorkflowTemplateOperator(
task_id='instantiate_inline_workflow_template', template=WORKFLOW_TEMPLATE, region=REGION
)
# [END how_to_cloud_dataproc_instantiate_inline_workflow_template]

pig_task = DataprocSubmitJobOperator(
task_id="pig_task", job=PIG_JOB, region=REGION, project_id=PROJECT_ID
)
Expand Down
7 changes: 5 additions & 2 deletions airflow/providers/google/cloud/operators/dataproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,8 +1673,11 @@ class DataprocInstantiateInlineWorkflowTemplateOperator(BaseOperator):
wait until the WorkflowTemplate is finished executing.

.. seealso::
Please refer to:
https://cloud.google.com/dataproc/docs/reference/rest/v1beta2/projects.regions.workflowTemplates/instantiateInline
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:DataprocInstantiateInlineWorkflowTemplateOperator`

For more detail on about instantiate inline have a look at the reference:
https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates/instantiateInline

:param template: The template contents. (templated)
:param project_id: The ID of the google cloud project in which
Expand Down
10 changes: 10 additions & 0 deletions docs/apache-airflow-providers-google/operators/cloud/dataproc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Prerequisite Tasks


.. _howto/operator:DataprocCreateClusterOperator:
.. _howto/operator:DataprocInstantiateInlineWorkflowTemplateOperator:

Create a Cluster
----------------
Expand Down Expand Up @@ -212,6 +213,15 @@ Once a workflow is created users can trigger it using
:start-after: [START how_to_cloud_dataproc_trigger_workflow_template]
:end-before: [END how_to_cloud_dataproc_trigger_workflow_template]

The inline operator is an alternative. It creates a workflow, run it, and delete it afterwards:
:class:`~airflow.providers.google.cloud.operators.dataproc.DataprocInstantiateInlineWorkflowTemplateOperator`:

.. exampleinclude:: /../../airflow/providers/google/cloud/example_dags/example_dataproc.py
:language: python
:dedent: 4
:start-after: [START how_to_cloud_dataproc_instantiate_inline_workflow_template]
:end-before: [END how_to_cloud_dataproc_instantiate_inline_workflow_template]

Create a Batch
--------------

Expand Down
1 change: 0 additions & 1 deletion tests/always/test_project_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ class TestGoogleProviderProjectStructure(unittest.TestCase):

# Please at the examples to those operators at the earliest convenience :)
MISSING_EXAMPLES_FOR_OPERATORS = {
'airflow.providers.google.cloud.operators.dataproc.DataprocInstantiateInlineWorkflowTemplateOperator',
'airflow.providers.google.cloud.operators.mlengine.MLEngineTrainingCancelJobOperator',
'airflow.providers.google.cloud.operators.dlp.CloudDLPGetStoredInfoTypeOperator',
'airflow.providers.google.cloud.operators.dlp.CloudDLPReidentifyContentOperator',
Expand Down