노트북을 재기동하면 Dataset이 초기화 됩니다.

작성자 김아름 수정일 2022-10-24 16:34

#SparklingSoDA4.0, #스파클링소다4.0, #dataset, #데이터셋, #노트북

아티클 관련 제품: SparklingSoDA4.0

오류 메세지 혹은 현상
  • 노트북 생성 시, Dataset을 선택했습니다.
  • 다른 개발자도 동일한 Dataset을 선택하여 노트북을 생성하였습니다.
  • 한 개발자가 Dataset을 수정하고 있는 중에 다른 개발자가 노트북을 재 기동 하였습니다.
  • 그때, 수정하였던 Dataset이 모두 초기화 되었습니다.

    동일한 dataset인 iris 데이터를 선택한 노트북 2개를 생성하였습니다. 

    test-1 노트북에서 /datasets/iris 하위에서 test.txt 라는 파일을 생성하였습니다.
    cd /datasets/iris
    touch test.txt
    ls -al
    total 4
    drwxr-xr-x 2 root root   46 Oct 23 20:14 .
    drwxrwxrwx 3 root root   18 Oct 23 20:13 ..
    -rw-r--r-- 1 root root 3769 Oct 20 20:46 iris_dataset.csv
    -rw-r--r-- 1 root root    0 Oct 23 20:14 test.txt


    test-2 노트북에서도 해당 파일을 확인할 수 있었습니다.

    cd /datasets/iris
    ls -al
    total 4
    drwxr-xr-x 2 root root   46 Oct 23 20:14 .
    drwxrwxrwx 3 root root   18 Oct 23 20:13 ..
    -rw-r--r-- 1 root root 3769 Oct 20 20:46 iris_dataset.csv
    -rw-r--r-- 1 root root    0 Oct 23 20:14 test.txt


    이때 dataset을 update하지 않은 상태에서, test-2 노트북을 재 기동 하였습니다.


    test-1과 test-2 노트북에서 모두 처음의 dataset으로 초기화 되었습니다.
    ls -al
    total 4
    drwxr-xr-x 2 root root   30 Oct 23 20:18 .
    drwxrwxrwx 3 root root   18 Oct 23 20:13 ..
    -rw-r--r-- 1 root root 3769 Oct 20 20:46 iris_dataset.csv



원인
  • 노트북이 올라올 때, Dataset은 minio에 저장되어 있는 dataset을 다운로드합니다.

    노트북 pod의 log를 통해 확인할 수 있습니다.
    kubectl get po
    NAME                                                      READY   STATUS      RESTARTS   AGE     IP           NODE     NOMINATED NODE   READINESS GATES
    test-prj-jupyter0836c-0                                   2/2     Running     0          10m     6.2.171.77   worker   <none>           <none>
    
    kubectl logs -f <notebook-name>


    아래 로그를 보면, iris dataset을 remote repository에서 다운로드 합니다.

    --> Start iris dataset importing.
    2022-10-23 20:18:07,048 | sodaflow.api | INFO | Download dataset[iris] from remote repository [override option]
    2022-10-23 20:18:07,129 | sodaflow.api | INFO | Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
    
    --> iris dataset imported.


    remote repository는 아래와 같이 정의되어 있습니다.

    S3_DATASET_STORAGE = 'minio://dvc-storage/datasets'
    remote_path = f"{S3_DATASET_STORAGE}/{ds_name}"


    여기서 ds_name은 노트북 pod 내의 환경 변수로 설정되어 있습니다.

    kubectl describe po <notebook-name> | grep DS_NAME
    
    kubectl describe po test-prj-jupyter1b079-0 | grep DS_NAME
          DS_NAMES:                iris



  • 다운로드 한 dataset은 project의 pvc로 마운트 되어 있습니다.

    kubectl describe po <notebook-name>
    
    kubectl describe po test-prj-jupyter1b079-0
    
        Mounts:
          /datasets from dataset-storage (rw,path="datasets")
    
    Volumes:
      dataset-storage:
        Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
        ClaimName:  test-prj
        ReadOnly:   false

    위 결과를 통해 알 수 있는 것은, 프로젝트 내의 모든 노트북들은 dataset-storage의 pvc와 /datasets 경로가 mount 되어 있습니다.
    이때 dataset-storage는 프로젝트 이름의 pvc 입니다.

    이러한 이유로 dataset을 수정하는 중에 다른 노트북을 재 기동 하게 되면,
    최초의 dataset으로 초기화 되는 것입니다.



문제 해결
  • 다른 사용자들과 별개로 dataset을 수정하고자 한다면, /datasets 하위에 있는 데이터를 다른 경로로 복사하여 사용해야 합니다.

    cd /datasets/
    cp -r <dataset-name> /notebooks/<project-name>
    
    cp -r iris/ /notebooks/test-prj/
    ls -al
    total 44
    drwxr-xr-x 4 root root  179 Oct 23 20:36  .
    drwxrwxrwx 3 root root   22 Oct 23 20:36  ..
    drwxr-xr-x 8 root root  163 Oct 23 20:12  .git
    -rw-r--r-- 1 root root   12 Oct 23 20:12  README.md
    drwxr-xr-x 2 root root   30 Oct 23 20:35  iris



아티클이 유용했나요?

훌륭합니다!

피드백을 제공해 주셔서 감사합니다.

도움이 되지 못해 죄송합니다!

피드백을 제공해 주셔서 감사합니다.

아티클을 개선할 수 있는 방법을 알려주세요!

최소 하나의 이유를 선택하세요
CAPTCHA 확인이 필요합니다.

피드백 전송

소중한 의견을 수렴하여 아티클을 개선하도록 노력하겠습니다.

02-558-8300