티스토리 뷰

목표

1) 좀더 개선한 스크립트 공유

2) 기존의 jupyter server 일괄 stop 하는 script 추가

 

 

bash script

: github 주소: https://github.com/nicewook/jupyter_on_gcp

 

jinit.sh

1) VM 생성후 실행시 사용할 init script

2) 사용법

- 아래 script 생성한 VM ssh 에서 실행

$bash jinit.sh

-  이후 아래쪽에 생성되는 url 클릭하면 local computer 브라우저를 통해 jupyter lab server 접속된다.






참고

1) firewall tag 들을 추가할때에는 comma(,) 외에 스페이스가 없어야 한다

2) 변수들 사용시 $MYVAR, ${MYVAR}, "${MYVAR}" 간에는 미묘한 차이가 있다.

3) jupyter lab --ip='0.0.0.0' --no-browser & 실행시 바로 다음 스크립트로 넘어가지 않고 "Enter" 필요하다

- echo "" | 역할을 해준다.  (spectial thanks to facebook 양세훈님)

 

jrun.sh

 

-  jinit.sh 통해 jupyter lab server 세팅된 이후 실행시 사용






jstop.sh

 

- 현재 실행되어 있는 모든 jupyter server stop

* space 띄어져 있는 string array 바꿔주는 2번에 주목

- stack overflow 링크: https://stackoverflow.com/questions/19657683/convert-a-text-string-in-bash-to-array





exercise

 

1) create vm

- 아무 설정도 건드리지 않고 GCP VM 생성해본다

 

2) get script

- script 가져온다

- ssh VM 들어가

- sudo apt-get install git -y

- git clone https://github.com/nicewook/jupyter_on_gcp.git

- cd jupyter_on_gcp/

 

3) bash jinit.sh

- jupyter lab 실행환경을 세팅한다

- 마지막에 나오는 링크를 클릭하여 브라우저에 jupyter lab 뜨는 것을 확인

 

4) bash jstop.sh

- jupyter notebook list: 현재 돌아가고 있는 jupyter lab server 확인

- bash jstop.sh: 모든 jupyter lab server stop

 

5) bash jrun.sh

- bash jinit.sh 세팅이 이후에는 스크립트로 실행

- 마지막에 나오는 링크를 클릭하여 브라우저에 jupyter lab 뜨는 것을 확인


반응형
반응형
잡학툰 뱃지
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함