using server for deep-learning model execution
export USER_NAME=user1 # 각자마다 고유의 user_name을 통해 QUEUE가 겹치지 않도록 설정함. python producer.py
- 터미널 창에서 경로에 따라간 후 python /경로/consumer.py 입력, Enter
- Waiting for message 라는 메시지가 나오면 실행 완료
- Error 메시지가 나올 경우 Error 메시지 복사해서 관리자에게 문의
python producer.py --config_path path/to/your/config.yaml --script_path path/to/your/train.py
--> python C:\Users\User\Desktop\AIBoostcamp\redis_rabbtMQ\src\producer.py --config_path C:\Users\User\Desktop\AIBoostcamp\level1-imageclassification-cv-24\configs --script_path C:\Users\User\Desktop\AIBoostcamp\level1-imageclassification-cv-24\main.py --data_path C:\Users\User\Desktop\AIBoostcamp\level1-imageclassification-cv-24\data --> python C:\Users\User\Desktop\AIBoostcamp\redis_rabbtMQ\src\producer.py --config_path C:\Users\User\Desktop\AIBoostcamp\level2-objectdetection-cv-24\mmdetection\configs\cascade_rcnn --script_path C:\Users\User\Desktop\AIBoostcamp\level2-objectdetection-cv-24\mmdetection\train.py --data_path C:\Users\User\Desktop\AIBoostcamp\level2-objectdetection-cv-24\dataset --> python C:\Users\User\Desktop\AIBoostcamp\redis_rabbtMQ\src\det_producer.py --config_path "C:\Users\User\Desktop\AIBoostcamp\level2-objectdetection-cv-24\mmdetection\configs\custom_configs\haegang_test.py" --work-dir "C:\Users\User\Desktop\AIBoostcamp\level2-objectdetection-cv-24\mmdetection\work_dirs\codino_swin_lsj" --script_path "C:\Users\User\Desktop\AIBoostcamp\level2-objectdetection-cv-24\mmdetection\train.py" --seed 42 --device cuda (새로운 producer.py, train.py를 --args로 받는 경우 사용)
--> python src/producer.py --config_path /data/ephemeral/home/level1-imageclassification-cv-24/configs --script_path /data/ephemeral/home/level1-imageclassification-cv-24/main.py --data_path /data/ephemeral/home/level1-imageclassification-cv-24/data
--> python src/producer.py --config_path /data/ephemeral/home/level1-imageclassification-cv-24/configs --script_path /data/ephemeral/home/level1-imageclassification-cv-24/main.py --data_path /data/ephemeral/home/level1-imageclassification-cv-24/data --model_name faster_rcnn
- not matching erlang cookie
- check your C\Users\Yourusername\erlang.cookie file
- fine erlang.cookie file in system32.config.systemprofile and copy/paste to user folder
- To check its working
- rabbitmqctl status
- rabbitmq-plugins enable rabbitmq_management (executing)
- go to web-interface(http://localhost:PORT)
- check the log file (C:\Users\Yourusername\AppData\Roaming\RabbitMQ\log)
- Check queue works rabbitmqctl add_vhost test_vhost rabbitmqctl add_user test_user test_password rabbitmqctl set_permissions -p test_vhost test_user "." "." ".*" ** 권한 해제 및 유저 빼기 ** rabbitmqctl clear_permissions -p test_vhost test_user rabbitmqctl delete_user test_user rabbitmqctl delete_vhost test_vhost
- Run your file in python
- To start rabbitmqctl / rabbitmq
- rabbitmqctl start_app -> rabbitmqctl status
- net start rabbitmq, net stop rabbitmq
- 방화벽 차단 (Firewall issue) 풀기
- Windows Defender 방화벽 검색 후 실행
- 고급 설정 클릭
- 인바운드 규칙 클릭
- RabbitMQ 관련 규칙 찾기
- 규칙이 있다면 상태가 사용인지 확인
- 규칙이 없다면 새 규칙 버튼을 클릭 -> 포트 선택 -> TCP와 특정 로컬 5672 입력 -> 연결 허용 -> 프로필 선택 -> 이름 지정 후 저장
- cmd에서 확인 -> netsh advfirewall firewall show rule name=all | findstr /i "5672"
- 방화벽 해제 cmd
- netsh advfirewall firewall add rule name="Redis" dir=in action=allow protocol=TCP localport=6379
이 가이드는 로컬 개발 환경에서 Redis와 RabbitMQ를 설치하고 실행하는 방법을 설명합니다.
- Redis for Windows에서 최신 버전을 다운로드합니다.
- 다운로드한 파일을 압축 해제하고 원하는 위치에 저장합니다.
- 명령 프롬프트를 열고 Redis가 설치된 디렉토리로 이동합니다.
redis-server.exe
를 실행하여 Redis 서버를 시작합니다.
- Homebrew를 사용하여 Redis를 설치합니다: brew install redis
- Redis 서버 시작하기: brew services start redis
- 터미널에서 다음 명령어 실행하여 redis 설치: apt-get install sudo apt-get install systemctl sudo apt update sudo apt install redis-server
- Redis 서버 시작하기 sudo systemctl start redis-server 안되면 sudo service redis-server start
- Redis 서버 종료하기 sudo systemctl stop redis-server 안되면 sudo service redis-server stop
- Erlang을 다운로드하고 설치합니다.
- RabbitMQ를 다운로드하고 설치합니다.
- 시작 메뉴에서 RabbitMQ Command Prompt를 실행합니다.
- 다음 명령어로 RabbitMQ 서버를 시작합니다: rabbitmq-server / net start rabbitmq
- Homebrew를 사용하여 RabbitMQ를 설치합니다: brew install rabbitmq
- RabbitMQ 서버를 시작합니다: brew services start rabbitmq
- RabbitMQ를 설치합니다: sudo apt update sudo apt install rabbitmq-server
- RabbitMQ 서버를 시작합니다: sudo systemctl start rabbitmq-server 안되면 sudo service rabbitmq-server start
- RabbitMQ 서버 종료하기 sudo systemctl stop rabbitmq-server 안되면 sudo service rabbitmq-server stop
- 프로젝트 루트 디렉토리에 있는
.env.example
파일을 복사하여.env
파일을 src 밑에 만들어주면 됩니다. .env
파일을 열고 필요한 경우 설정을 수정합니다. 기본값은 다음과 같습니다: RABBITMQ_HOST=localhost RABBITMQ_PORT=5672 RABBITMQ_USER=guest RABBITMQ_PASSWORD=guest REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD='' USER_NAME='your_name'
- Redis가 실행 중인지 확인: redis-cli ping (이건 Window나 macOS 사용 시 cmd에서 실행) "PONG" 응답이 오면 정상 작동 중입니다. sudo service redis-server status -> 확인
- RabbitMQ가 실행 중인지 확인: rabbitmqctl status (이건 Window나 macOS 사용 시 cmd에서 실행) sudo service rabbitmq-server status -> 확인 상태 정보가 표시되면 정상 작동 중입니다. 문제가 발생하거나 추가 도움이 필요한 경우 프로젝트 관리자에게 문의하세요.
- 각자의 main.py가 있는 프로젝트를 터미널에서 새로 열어주고
- pip install wandb (설치가 안되어있는 경우) wandb login
- wandb: You can find your API key in your browser here: https://wandb.ai/authorize wandb: Paste an API key from your profile and hit enter: 이 명령어가 나오면 https://wandb.ai/authorize 에 가서 로그인 후 나오는 API키 복사하여 터미널에 붙여넣고 Enter
- 로그인 확인: wandb: Appending key for api.wandb.ai to your netrc file: /home/username/.netrc -> 성공 메시지