Criar um cluster do JupyterLab do Dataproc no Dataproc Hub
Selecione a guia Notebooks gerenciados pelo usuário na página
Dataproc→Workbench
no console Google Cloud .
Clique em Abrir JupyterLab na linha que
lista a instância do Dataproc Hub criada pelo administrador.
Se você não tiver acesso ao console do Google Cloud , insira o URL da instância do Dataproc Hub que um administrador compartilhou com você no navegador da Web.
Na página Jupyterhub→Opções do Dataproc, selecione uma configuração de cluster e uma zona. Se estiver ativado, especifique as personalizações e clique em Criar.
Depois que o cluster do Dataproc for criado, você será redirecionado
para a interface do JupyterLab em execução no cluster.
Criar um notebook e executar um job do Spark
No painel esquerdo da interface do JupyterLab, clique em GCS (Cloud Storage).
Crie um notebook PySpark no iniciador do JupyterLab.
O kernel do PySpark inicializa um SparkContext (usando a variável sc).
Você pode examinar o SparkContext e executar um job do Spark no notebook.
rdd = (sc.parallelize(['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'lorem'])
.map(lambda word: (word, 1))
.reduceByKey(lambda a, b: a + b))
print(rdd.collect())
Nomeie e salve o notebook. O notebook é salvo e permanece no Cloud Storage depois que o cluster do Dataproc for excluído.
Encerrar o cluster do Dataproc
Na interface do JupyterLab, selecione Arquivo→Painel de controle do hub para
abrir a página Jupyterhub.
Clique em Parar Meu cluster para encerrar (excluir) o servidor do JupyterLab, que
exclui o cluster do Dataproc.
[[["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\u003eDataproc Hub and Vertex AI Workbench user-managed notebooks are deprecated and will no longer be supported after January 30, 2025.\u003c/p\u003e\n"],["\u003cp\u003eYou can use Dataproc Hub to create a single-user JupyterLab notebook environment running on a Dataproc cluster, utilizing a configured cluster and zone from the Dataproc Options page.\u003c/p\u003e\n"],["\u003cp\u003eUsers can create a PySpark notebook within the JupyterLab interface, allowing them to run Spark jobs, and the notebook is saved in Cloud Storage even after the Dataproc cluster is deleted.\u003c/p\u003e\n"],["\u003cp\u003eTo shut down the Dataproc cluster, users must navigate to the Jupyterhub page and click "Stop My Cluster," which deletes the JupyterLab server and the Dataproc cluster, but not the Dataproc Hub instance itself.\u003c/p\u003e\n"],["\u003cp\u003eThe admin user must grant the \u003ccode\u003enotebooks.instances.use\u003c/code\u003e permission for a user to be able to utilize Dataproc Hub.\u003c/p\u003e\n"]]],[],null,[]]