Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
É possível usar um seletor de cluster para escolher um cluster existente para o fluxo de trabalho como alternativa à execução de um fluxo de trabalho em um cluster gerenciado. Ao final do fluxo de trabalho, o cluster selecionado não é excluído.
Os seletores especificam um ou mais rótulos de usuário do Dataproc.
Os clusters na mesma região do fluxo de trabalho em que os rótulos correspondem a todos os rótulos seletores estão qualificados para executar jobs de fluxo de trabalho. Se vários clusters corresponderem ao seletor, o Dataproc escolherá o cluster com a memória YARN que tiver mais espaço livre.
Adicionar um seletor de cluster a um modelo
É possível adicionar um seletor de cluster a um modelo de fluxo de trabalho usando a
Google Cloud CLI ou a API Dataproc.
É possível visualizar modelos de fluxo de trabalho atuais e fluxos de trabalho instanciados a partir da página Fluxos de trabalho do Dataproc no Google Cloud console.
[[["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\u003eCluster selectors allow workflows to run on existing clusters instead of managed clusters, and the selected cluster is not deleted post-workflow.\u003c/p\u003e\n"],["\u003cp\u003eSelectors use Dataproc user labels to identify eligible clusters within the same region as the workflow, and Dataproc chooses the cluster with the most free YARN memory if multiple clusters match.\u003c/p\u003e\n"],["\u003cp\u003eYou can add a cluster selector to a workflow template using either the Google Cloud CLI or the Dataproc API, with options to set specific cluster labels.\u003c/p\u003e\n"],["\u003cp\u003eAutomatically-applied cluster labels like \u003ccode\u003egoog-dataproc-cluster-name\u003c/code\u003e and \u003ccode\u003egoog-dataproc-cluster-uuid\u003c/code\u003e can be used to point a cluster selector to an existing cluster.\u003c/p\u003e\n"],["\u003cp\u003eClusters with matching labels can be used to create cluster pools, and the workflow template can select a cluster within that pool based on the applied labels.\u003c/p\u003e\n"]]],[],null,["# Use cluster selectors with workflows\n\nAs an alternative to running a workflow on a\n[managed cluster](/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster), you can use a\ncluster selector to choose an existing cluster for your workflow. At the\nconclusion of the workflow, the selected cluster is not deleted.\n\nSelectors specify one or more\n[Dataproc user labels](/dataproc/docs/concepts/labels).\nClusters in same\n[region](/compute/docs/regions-zones#available) as the workflow whose labels\nmatch all of the selector labels are eligible to run workflow jobs. If multiple\nclusters match the selector, Dataproc will\nchoose the cluster with the most free YARN memory.\n\nAdd a cluster selector to a template\n------------------------------------\n\nYou can add a cluster selector to a workflow template using the\nGoogle Cloud CLI or the Dataproc API. \n\n### gcloud command\n\n```\ngcloud dataproc workflow-templates set-cluster-selector template-id \\\n --region=region \\\n --cluster-labels=name=value[[,name=value]...]\n```\n\n### REST API\n\nSee [WorkflowTemplatePlacement.ClusterSelector](/dataproc/docs/reference/rest/v1/projects.locations.workflowTemplates#clusterselector). This field is provided as part of a completed [WorkflowTemplate](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates#resource-workflowtemplate) submitted with a [workflowTemplates.create](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates/create) or [workflowTemplates.update](/dataproc/docs/reference/rest/v1/projects.regions.workflowTemplates/update) request.\n\n### Console\n\nYou can view existing workflow templates and instantiated workflows from\nthe Dataproc\n[**Workflows**](https://console.cloud.google.com/dataproc/workflows/instances) page in Google Cloud console.\n\nUse automatically applied labels\n--------------------------------\n\nYou can point a cluster selector to an existing cluster by using\none of the following [automatically-applied cluster labels](/dataproc/docs/concepts/labels#automatically-applied_labels):\n\n- `goog-dataproc-cluster-name`\n- `goog-dataproc-cluster-uuid`\n\n**Example:** \n\n```\ngcloud dataproc workflow-templates set-cluster-selector template-id \\\n --region=region \\\n --cluster-labels=goog-dataproc-cluster-name=my-cluster\n```\n\n\u003cbr /\u003e\n\nSelect from a cluster pool\n--------------------------\n\nYou can let Dataproc choose a cluster from a pool of clusters.\nThe cluster pools can be defined with labels.\n\n**Example:** \n\n```\ngcloud dataproc clusters create cluster-1 --labels cluster-pool=pool-1 \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\ngcloud dataproc clusters create cluster-2 --labels cluster-pool=pool-1 \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\ngcloud dataproc clusters create cluster-3 --labels cluster-pool=pool-2 \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\n```\n\nAfter cluster creation ... \n\n```\ngcloud dataproc workflow-templates create my-template \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e\ngcloud dataproc workflow-templates set-cluster-selector my-template \\\n --region=\u003cvar translate=\"no\"\u003eregion\u003c/var\u003e \\\n --cluster-labels=cluster-pool=pool-1\n```\n\nThe workflow will be run on either cluster-1 or cluster-2, but not on cluster-3."]]