Criar um cluster do Dataproc JupyterLab no Dataproc Hub
Selecione a guia Notebooks gerenciados pelo usuário na página
Dataproc → Workbench
no console do Google Cloud.
Clique em Abrir o 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→Dataproc Options, 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 é criado, você é 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 File→Hub Control Panel 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-04-21 UTC."],[[["Dataproc Hub and Vertex AI Workbench user-managed notebooks are deprecated and will no longer be supported after January 30, 2025."],["You 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."],["Users 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."],["To 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."],["The admin user must grant the `notebooks.instances.use` permission for a user to be able to utilize Dataproc Hub."]]],[]]