Assessment Lab: Working with Data Science Projects

In this lab, you will practice the use of data science projects, permissions, workbenches, environment variables, and data connections.

Prerequisites

To perform this lab, ensure that your platform meets the following conditions:

  • An S3 bucket. If you do not have an S3 object store available, follow the guide to create an S3 bucket by using Minio.

  • The data-scientists user group exists in OpenShift.

    To create the data-scientists group, log in as a user with administrator privilege in OpenShift and then apply the https://raw.githubusercontent.com/RedHatQuickCourses/rhods-qc-apps/main/1.intro/chapter2/lab/group.yaml file:

    apiVersion: user.openshift.io/v1
    kind: Group
    metadata:
      name: data-scientists
    users:
      - user4
      - user5

    If you use the oc CLI in your computer or terminal from OpenShift web console, then you can run:

    $ oc create -f \
    https://raw.githubusercontent.com/RedHatQuickCourses/rhods-qc-apps/main/1.intro/chapter2/lab/group.yaml
  • The user4 and user5 users exist in OpenShift and are assigned to the data-scientists group.

  • The oc CLI installed on your computer. Alternatively, you can use the OpenShift web console.

The identity provider of your demo platform already includes these users (user4 and user5).

Specifications

  • Create two data science projects as user1: intro-projects-a and intro-projects-b.

  • Create a workbench in intro-projects-a.

    • Use the Standard Data Science image.

    • This workbench must be connected to the S3 bucket that is available in your demo platform.

    • Clone the https://github.com/RedHatQuickCourses/rhods-qc-apps repository in this workbench.

    • Execute the rhods-qc-apps/1.intro/chapter2/lab/test_connection.ipynb notebook in this workbench. This notebook contains code to verify that the connection to S3.

  • Create a workbench in intro-projects-b.

    • Select any image for this workbench.

    • Pass your name in the STUDENT_NAME environment variable.

    • Clone the https://github.com/RedHatQuickCourses/rhods-qc-apps repository in this workbench.

    • Execute the rhods-qc-apps/1.intro/chapter2/lab/test_env_vars.ipynb notebook in this workbench. This notebook contains code to read the environment variable.

  • The data-scientists group must have edit permissions in intro-projects-a.

  • Only the user4 user must have edit permissions in intro-projects-b.

Solution

  1. Create the projects.

    1. Login as the user1 to Red Hat OpenShift AI console.

    2. From your RHOAI dashboard, click Data Science Projects in the left navigation pane.

    3. In the Data science projects page, click Create data science project.

    4. Enter intro-projects-a as the project name and click Create.

    5. Repeat the same steps to create intro-projects-b.

  2. Create a workbench connected to S3 in intro-projects-a.

    1. Navigate the intro-projects-a dashboard and click Create workbench. In the workbench creation page, enter the workbench name, select the workbench image as Standard Data Science image, and the image version.

    2. Select Small as the container size.

    3. In the Data connections section, select Use a data connection.

    4. Enter the configuration values of your S3 connection.

    5. Click Create workbench to finish the creation of the workbench and the data connection.

  3. Verify the connection of the workbench in intro-projects-a.

    1. Open the workbench of the intro-projects-a project.

    2. Log in as user1 to JupyterLab and accept the access form.

    3. Clone the https://github.com/RedHatQuickCourses/rhods-qc-apps repository.

    4. Navigate to rhods-qc-apps/1.intro/chapter2/lab and run the test_connection.ipynb notebook. You should see the buckets available in S3.

      lab test connection
  4. Create a workbench that receives the STUDENT_NAME environment variable in intro-projects-b.

    1. Navigate the intro-projects-b dashboard and click Create workbench. In the workbench creation page, enter the workbench name, select the workbench image as Standard Data Science image, and the image version.

    2. Select Small as the container size.

    3. In the Environment variables section, click Add variable.

    4. Select Config Map as the environment variable type. Then select Key/value.

    5. Enter STUDENT_NAME as the key, and your name as the value.

      lab env vars
    6. Click Create workbench to finish the creation of the workbench and the data connection.

  5. Verify the variable injected in the workbench in intro-projects-b.

    1. Open the workbench of the intro-projects-b project.

    2. Log in as user1 to JupyterLab and accept the access form.

    3. Clone the https://github.com/RedHatQuickCourses/rhods-qc-apps repository.

    4. Navigate to rhods-qc-apps/1.intro/chapter2/lab and run the test_env_vars.ipynb notebook. You should see a hello message that includes your name.

      lab test env vars
  6. Set the project permissions of intro-projects-a.

    1. Navigate the intro-projects-a dashboard and click Permissions.

    2. Click Add group and enter data-scientists as the group name. Verify that the Permission selector is set to Edit and click the button.

    3. Log out and log back in with both user4 and user5 users. Verify that both users have access to the intro-projects-a project.

  7. Set the project permissions of intro-projects-b.

    1. Log out and log back in as user1.

    2. Navigate the intro-projects-b dashboard and click Permissions.

    3. Click Add user and enter user4 as the username. Verify that the Permission selector is set to Edit and click the button.

    4. Log out and log back in with both user4 and user5 users. Verify that user4 can access the intro-projects-b project. Next, verify that user5 cannot access the intro-projects-b project.