Crea un clúster de Dataproc JupyterLab desde Dataproc Hub
Selecciona la pestaña Notebooks administrados por el usuario en la página Dataproc→Workbench de la Google Cloud consola.
Haz clic en Abrir JupyterLab en la fila que enumera la instancia de Dataproc Hub creada por el administrador.
Si no tienes acceso a la consola de Google Cloud , ingresa en tu navegador web la URL de la instancia de Dataproc Hub que un administrador compartió contigo.
En la página Jupyterhub→Opciones de Dataproc, selecciona una configuración y una zona del clúster. Si está habilitada, especifica las personalizaciones y, luego, haz clic en Crear.
Después de crear el clúster de Dataproc, se te redireccionará a la interfaz de JupyterLab que se ejecuta en el clúster.
Crea un notebook y ejecuta un trabajo de Spark
En el panel izquierdo de la interfaz de JupyterLab, haz clic en GCS (Cloud Storage).
Crea un notebook de PySpark desde el selector de JupyterLab.
El kernel de PySpark inicializa un SparkContext (mediante la variable sc).
Puedes examinar SparkContext y ejecutar un trabajo de Spark desde el notebook.
rdd = (sc.parallelize(['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'lorem'])
.map(lambda word: (word, 1))
.reduceByKey(lambda a, b: a + b))
print(rdd.collect())
Asigna un nombre y guarda el notebook. El notebook se guarda y permanece en Cloud Storage después de que se borra el clúster de Dataproc.
Cierra el clúster de Dataproc
En la interfaz de JupyterLab, selecciona Archivo→Panel de control de Hub para abrir la página Jupyterhub.
Haz clic en Detener mi clúster para cerrar (borrar) el servidor de JupyterLab, que borra el clúster de Dataproc.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (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,["# Use Dataproc Hub\n\n*** ** * ** ***\n\n|\n| Dataproc Hub and\n| Vertex AI Workbench user-managed notebooks are\n| deprecated. On January 30, 2025, support for user-managed notebooks\n| will end and the ability to create user-managed notebooks instances\n| will be removed. For alternative notebook solutions\n| on Google Cloud, see:\n|\n| - [Install\n| the Jupyter component on your Dataproc cluster](/dataproc/docs/concepts/components/jupyter#install_jupyter).\n| - [Create\n| a Dataproc-enabled\n| Vertex AI Workbench instance](/vertex-ai/docs/workbench/instances/create-dataproc-enabled).\n\nObjectives\n----------\n\n1. Use Dataproc Hub to create a single-user\n JupyterLab notebook environment running on a Dataproc cluster.\n\n2. Create a notebook and run a Spark job on the Dataproc cluster.\n\n3. Delete your cluster and preserve your notebook in Cloud Storage.\n\nBefore you begin\n----------------\n\n1. The administrator must grant you `notebooks.instances.use` permission (see [Set Identity and Access Management (IAM) roles](/dataproc/docs/tutorials/dataproc-hub-admins#set_identity_and_access_management_iam_roles)). \n\nCreate a Dataproc JupyterLab cluster from Dataproc Hub\n------------------------------------------------------\n\n1. Select the **User-Managed Notebooks** tab on the\n **[Dataproc→Workbench](https://console.cloud.google.com/dataproc/workbench)**\n page in the Google Cloud console.\n\n2. Click **Open JupyterLab** in the row that\n lists the Dataproc Hub instance created by the administrator.\n\n 1. If you do not have access to the Google Cloud console, enter the Dataproc Hub instance URL that an administrator shared with you in your web browser.\n3. On the **Jupyterhub→Dataproc Options** page, select\n a cluster configuration and zone. If enabled, specify any customizations, then\n click **Create**.\n\n After the Dataproc cluster is created, you are redirected\n to the JupyterLab interface running on the cluster.\n\nCreate a notebook and run a Spark job\n-------------------------------------\n\n1. On the left panel of the JupyterLab interface, click on `GCS` (Cloud Storage).\n\n2. Create a PySpark notebook from the JupyterLab launcher.\n\n3. The PySpark kernel initializes a SparkContext (using the `sc` variable).\n You can examine the SparkContext and run a Spark job from the notebook.\n\n ```\n rdd = (sc.parallelize(['lorem', 'ipsum', 'dolor', 'sit', 'amet', 'lorem'])\n .map(lambda word: (word, 1))\n .reduceByKey(lambda a, b: a + b))\n print(rdd.collect())\n ```\n4. Name and save the notebook. The notebook is saved and remains in\n Cloud Storage after the Dataproc cluster is deleted.\n\nShut down the Dataproc cluster\n------------------------------\n\n1. From the JupyterLab interface, select **File→Hub Control Panel** to\n open the **Jupyterhub** page.\n\n | When using Dataproc image versions 1.4 or earlier, navigate to `/hub/home` to access the **Jupyterhub** page.\n2. Click **Stop My Cluster** to shut down (delete) the JupyterLab server, which\n deletes the Dataproc cluster.\n\n | Stopping the server and deleting the cluster **does not delete the Dataproc Hub instance** . You can click **Start my server** on the **Jupyterhub** (Hub Control Panel) page or select the **Open JupyterLab** link for your Dataproc Hub instance on the **Dataproc→Workbench→User-Managed Notebooks** page in the Google Cloud console to open configure and create another Dataproc JupyterLab cluster.\n\nWhat's next\n-----------\n\n- Explore [Spark and Jupyter Notebooks on Dataproc](https://github.com/GoogleCloudDataproc/cloud-dataproc/tree/master/notebooks) on GitHub."]]