def test_execute(self, mock_hook): op = DataprocCreateWorkflowTemplateOperator( task_id=TASK_ID, gcp_conn_id=GCP_CONN_ID, impersonation_chain=IMPERSONATION_CHAIN, location=GCP_LOCATION, project_id=GCP_PROJECT, retry=RETRY, timeout=TIMEOUT, metadata=METADATA, template=WORKFLOW_TEMPLATE, ) op.execute(context={}) mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID, impersonation_chain=IMPERSONATION_CHAIN) mock_hook.return_value.create_workflow_template.assert_called_once_with( location=GCP_LOCATION, project_id=GCP_PROJECT, retry=RETRY, timeout=TIMEOUT, metadata=METADATA, template=WORKFLOW_TEMPLATE, )
# [START how_to_cloud_dataproc_update_cluster_operator] scale_cluster = DataprocUpdateClusterOperator( task_id="scale_cluster", cluster_name=CLUSTER_NAME, cluster=CLUSTER_UPDATE, update_mask=UPDATE_MASK, graceful_decommission_timeout=TIMEOUT, project_id=PROJECT_ID, region=REGION, ) # [END how_to_cloud_dataproc_update_cluster_operator] # [START how_to_cloud_dataproc_create_workflow_template] create_workflow_template = DataprocCreateWorkflowTemplateOperator( task_id="create_workflow_template", template=WORKFLOW_TEMPLATE, project_id=PROJECT_ID, region=REGION, ) # [END how_to_cloud_dataproc_create_workflow_template] # [START how_to_cloud_dataproc_trigger_workflow_template] trigger_workflow = DataprocInstantiateWorkflowTemplateOperator( task_id="trigger_workflow", region=REGION, project_id=PROJECT_ID, template_id=WORKFLOW_NAME) # [END how_to_cloud_dataproc_trigger_workflow_template] pig_task = DataprocSubmitJobOperator(task_id="pig_task", job=PIG_JOB, region=REGION,