Visão geral dos modelos de fluxo de trabalho do Dataproc
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A API WorkflowTemplates do Dataproc oferece um mecanismo flexível e fácil de usar para gerenciar e executar fluxos de trabalho. Um modelo de fluxo de trabalho é uma configuração de fluxo de trabalho reutilizável. Ele define um gráfico de jobs com informações sobre onde executar esses jobs.
Se usar um cluster gerenciado, o fluxo de trabalho criará o cluster, executará os jobs e excluirá o cluster quando os jobs forem concluídos.
Se usar um seletor de clusters, o fluxo de trabalho executará jobs em um cluster atual selecionado.
Os fluxos de trabalho são ideais para fluxos de job complexos. Você pode criar dependências de job para que um job seja iniciado somente após a conclusão das dependências.
Quando você cria um modelo de fluxo de trabalho, o Dataproc
não cria um cluster nem envia jobs para um cluster.
O Dataproc cria ou seleciona um cluster e executa jobs de fluxo de trabalho nele quando um modelo de fluxo de trabalho é instanciado.
Tipos de modelos de fluxo de trabalho
Cluster gerenciado
Um modelo de fluxo de trabalho pode especificar um cluster gerenciado. O fluxo de trabalho vai criar um cluster "efêmero" para executar jobs e excluir o cluster quando o fluxo for concluído.
Seletor de clusters
Um modelo de fluxo de trabalho pode especificar um cluster atual em que jobs de fluxo de trabalho são executados especificando um ou mais rótulos de usuário anexados anteriormente ao cluster. O fluxo de trabalho será executado em um cluster correspondente a todos os rótulos. Se vários clusters corresponderem a todos os rótulos, o Dataproc selecionará o cluster com mais memória disponível do YARN para executar todos os jobs do fluxo de trabalho. Ao final do fluxo de trabalho, o Dataproc não exclui o cluster selecionado. Consulte
Usar seletores de cluster com fluxos de trabalho
para mais informações.
Parametrizado
Se você executar um modelo de fluxo de trabalho várias vezes com valores diferentes, use parâmetros para evitar a edição do modelo de fluxo de trabalho para cada execução:
defina parâmetros no modelo e
transmitir valores diferentes para os parâmetros em cada execução.
Automação de tarefas repetitivas. Os fluxos de trabalho encapsulam configurações e trabalhos de cluster mais usados.
Modelo de interação da API Transactional fire-and-forget. Os modelos de fluxo de trabalho substituem as etapas envolvidas em um fluxo típico, que incluem:
criando o cluster
enviar jobs
sondagem
excluir o cluster
Os modelos de fluxo de trabalho usam um único token para rastrear o progresso, desde a criação do cluster até a exclusão, e automatizam o processamento e a recuperação de erros. Eles também simplificam a integração do Dataproc com outras ferramentas, como funções do Cloud Run e Cloud Composer.
Suporte para clusters efêmeros e de longa duração. Uma complexidade comum associada à execução do Apache Hadoop é ajustar e dimensionar clusters.
Os clusters efêmeros (gerenciados) são mais fáceis de configurar porque executam uma única carga de trabalho. Os seletores de clusters podem ser usados com clusters de vida mais longa para executar repetidamente a mesma carga de trabalho sem incorrer no custo amortizado de criar e excluir clusters.
Segurança granular do IAM. Criar clusters do Dataproc e enviar tarefas exigem permissões do IAM de tudo ou nada.
Os modelos de fluxo de trabalho usam uma permissão workflowTemplates.instantiate por modelo e não dependem de permissões de cluster ou job.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-22 UTC."],[[["\u003cp\u003eWorkflow Templates offer a reusable configuration for defining a series of jobs in a Directed Acyclic Graph (DAG), streamlining the management and execution of workflows.\u003c/p\u003e\n"],["\u003cp\u003eInstantiating a Workflow Template initiates a Workflow, which either creates an ephemeral cluster, runs the jobs, and then deletes the cluster, or utilizes a pre-existing cluster selected via labels.\u003c/p\u003e\n"],["\u003cp\u003eWorkflows are ideal for complex job sequences, allowing you to set job dependencies so that one job will only execute once the previous one has been completed successfully.\u003c/p\u003e\n"],["\u003cp\u003eWorkflow Templates can be parameterized to execute with varying values without the need to edit the template for each run, enhancing flexibility.\u003c/p\u003e\n"],["\u003cp\u003eWorkflow Templates simplify task automation and the integration of Dataproc with external tools by replacing manual cluster management steps with a single-token tracking process.\u003c/p\u003e\n"]]],[],null,["# Overview of Dataproc Workflow Templates\n\nThe Dataproc [WorkflowTemplates API](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates) provides a\nflexible and easy-to-use mechanism for managing and executing workflows. A\nWorkflow Template is a reusable workflow configuration. It defines a graph of\njobs with information on where to run those jobs.\n\n**Key Points:**\n\n- [Instantiating a Workflow Template](/dataproc/docs/concepts/workflows/using-workflows#running_a_workflow) launches a Workflow. A Workflow is an operation that runs a [Directed Acyclic Graph (DAG)](https://en.wikipedia.org/wiki/Directed_acyclic_graph) of jobs on a cluster.\n - If the workflow uses a [managed cluster](#managed_cluster), it creates the cluster, runs the jobs, and then deletes the cluster when the jobs are finished.\n - If the workflow uses a [cluster selector](#cluster_selector), it runs jobs on a selected existing cluster.\n- Workflows are ideal for complex job flows. You can create job dependencies so that a job starts only after its dependencies complete successfully.\n- When you [create a workflow template](/dataproc/docs/concepts/workflows/using-workflows#creating_a_template) Dataproc does not create a cluster or submit jobs to a cluster. Dataproc creates or selects a cluster and runs workflow jobs on the cluster when a workflow template is **instantiated**.\n\nKinds of Workflow Templates\n---------------------------\n\n### Managed cluster\n\nA workflow template can specify a managed cluster. The workflow will create an\n\"ephemeral\" cluster to run workflow jobs, and then delete the cluster when the\nworkflow is finished.\n\n### Cluster selector\n\nA workflow template can specify an existing cluster on which to run workflow\njobs by specifying one or more [user labels](/dataproc/docs/concepts/labels)\npreviously attached to the cluster. The workflow will run on a\ncluster that matches all of the labels. If multiple clusters match\nall labels, Dataproc selects the cluster with the most\nYARN available memory to run all workflow jobs. At the end of workflow,\nDataproc does not delete the selected cluster. See\n[Use cluster selectors with workflows](/dataproc/docs/concepts/workflows/cluster-selectors)\nfor more information.\n| A workflow can select a specific cluster by matching the `goog-dataproc-cluster-name` label (see [Using Automatically Applied Labels](/dataproc/docs/concepts/workflows/cluster-selectors#using_automatically_applied_labels)).\n\n### Parameterized\n\nIf you will run a workflow template multiple times with different values, use\nparameters to avoid editing the workflow template for each run:\n\n1. define parameters in the template, then\n\n2. pass different values for the parameters for each run.\n\nSee\n[Parameterization of Workflow Templates](/dataproc/docs/concepts/workflows/workflow-parameters)\nfor more information.\n\n### Inline\n\nWorkflows can be instantiated inline using the `gcloud` command with\n[workflow template YAML files](/dataproc/docs/concepts/workflows/using-yamls#instantiate_a_workflow_using_a_yaml_file) or by calling the Dataproc\n[InstantiateInline](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates/instantiateInline)\nAPI (see [Using inline Dataproc workflows](/dataproc/docs/concepts/workflows/inline-workflows)).\nInline workflows do not create or modify workflow template resources.\n| Inline workflows can be useful for rapid prototyping or automation.\n\nWorkflow Template use cases\n---------------------------\n\n- **Automation of repetitive tasks.** Workflows encapsulate frequently used\n cluster configurations and jobs.\n\n- **Transactional fire-and-forget API interaction model.** Workflow Templates\n replace the steps involved in a typical flow, which include:\n\n 1. creating the cluster\n 2. submitting jobs\n 3. polling\n 4. deleting the cluster\n\n Workflow Templates use a single token to track progress from cluster creation\n to deletion, and automate error handling and recovery. They also simplify the\n integration of Dataproc with other tools, such as Cloud Run functions\n and Cloud Composer.\n- **Support for ephemeral and long-lived clusters.** A common complexity\n associated with running Apache Hadoop is tuning and right-sizing clusters.\n Ephemeral (managed) clusters are easier to configure since they run a\n single workload. Cluster selectors can be used with\n longer-lived clusters to repeatedly execute the same workload\n without incurring the amortized cost of creating and deleting clusters.\n\n- **Granular IAM security.** Creating Dataproc clusters and\n submitting jobs require all-or-nothing IAM permissions.\n Workflow Templates use a per-template\n [workflowTemplates.instantiate](/dataproc/docs/concepts/iam/iam#workflow_templates_methods_required_permissions)\n permission, and do not depend on cluster or job permissions."]]