# Jamie's Working Wiki ## Homework in queue * [Missed semester](https://missing.csail.mit.edu/) * [Review practice](https://google.github.io/eng-practices/) ## Travis ci settings ### .travis.yml ```shell= **extend for 20min** - travis_wait 20 <any of your command> ``` ```shell= **stting timezone** - timedatectl set-timezone Asia/Taipei ``` <div style="page-break-after: always"></div> ## Frequently using command ### azure vm ```shell= alias server='sshpass -p Aa1234567890 ssh caleb@13.66.155.121' ``` ### azcopy * https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-blobs ```shell= azcopy copy "<local-directory-path>" "https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-name>" --recursive azcopy cp "https://aicscvdata.blob.core.windows.net/traffic-rule-violation-detection-assets/models/*${SAS_TOKEN}" "app/src/main/assets" ``` ### ssh tunnel **Forward port, maping=[local -> remote]** ```shell= export Local_Port=8088 export Remote_Port=8000 ssh -N -f -L ${Local_Port}:localhost:${Remote_Port} caleb@13.66.155.121 ``` ### Docker **Build docker file to image** ``` # at root folder of RAS docker build -t=stress_test -f dockerfiles/Dockerfile.stress_test . docker run -ti --rm\ --env-file=.env\ -e ROBOT_EMAIL=$ROBOT_EMAIL\ -e ROBOT_PWD=$ROBOT_PWD\ -e POKEDEX_URL=$POKEDEX_URL\ -e POKEBALL_URL=$POKEBALL_URL\ -e POKEBALL_ACCESS_KEY=$POKEBALL_ACCESS_KEY\ --name=stress_test stress_test\ ``` **Run container** ```shell= docker run -idt --name=py3cv \ -v ${host_path}:${container_path} \ -p ${host_port}:${container_port} \ -e ${container_env_var}=${what_you_want}\ tensorflow/tensorflow:1.13.2-gpu-py3 bash // using container env-var to run a command docker run -idt --name=py3cv \ -v ${host_path}:${container_path} \ -p ${host_port}:${container_port} \ -e ${container_env_var}=${what_you_want}\ tensorflow/tensorflow:1.13.2-gpu-py3 bash -c 'echo ${container_path}' ``` **Get into container** ```shell= docker exec -ti py3cv bash ``` **Stop/Remove all container** ```shell= docker stop $(docker ps -a -q) docker rm $(docker ps -a -q) docker rmi $(docker images -a -q) ``` ### Docker compose ```shell= ## build images in docker compose docker-compose build ## start docker-compose docker-compose up docker-compose up --build #build and start ##stop docker-compose docker-compose down docker-compose down --rmi local #stop docker-compose and remove local image ``` ### locust ``` locust -f rely_probe/locustfile.py\ -H https://aics-smretail-dev.southeastasia.cloudapp.azure.com/api/fas\ -u 1 -r 1\ -t 20s\ --headless\ --csv=test ``` ### Jupyters ```shell= ##run jupyter-lab in docker jupyter lab --allow-root --ip=0.0.0.0 --port=8000 ##run jupyter-notebook in docker jupyter notebook --allow-root --ip=0.0.0.0 --port=8000 ``` ### Tensorflow-Pb to snpe-dlc ```shell= cd <where_you_put_snpe_official_sdk> snpe-tensorflow-to-dlc --input_network <where_you_put_pb> --input_dim input 1,90,90,3 --out_node output_1 --output_path ~/Downloads/model.dlc --allow_unconsumed_nodes ``` ### Firefox cannot connect on ubuntu ```shell= cd ~/ .mozilla/firefox/ cd ********.default rm .parentlock ``` ## Askey data link * [Askey label v1](https://askeycloud.askey.com/owncloud/index.php/s/YhJPg6X58nCTX6h) * [Askey label v2](https://askeycloud.askey.com/owncloud/index.php/s/Es04c7xbbNuxubh?path=%2F) * [Askey label v2 - zip](https://drive.google.com/drive/u/0/folders/14LMLx_feUF4tE9WL9Tr0PQbBFIlt5UQy) * [Evaluation videos site1](https://askeycloud.askey.com/owncloud/index.php/s/QZFcBfxCQOv751D?path=%2F) * [Evaluation videos site2](https://askeycloud.askey.com/owncloud/index.php/s/TlvgvbcR1FjKFic) ## Github ssh code --------------------------------------------------- trvd-server aicstrvd --------------------------------------------------- ***如何讓git可以clone repository(SSO token 認證)*** fllow by (https://asus-aics.github.io/DeveloperGuide/ -> Authorizing a personal access token for use with a SAML SSO) 1.登入公司用Github 2.點選右上角圖示,展開list後選擇setting 3.在左側personal setting的清單中,選擇Developer Settings 4.在GitHub Apps的清單中,選擇Personal access token 5.Generate new token, 將scope全選, 在note命名token 6.將token記錄下來 7.選擇enable token, 後以OA帳戶登入之 8.開啟terminal, 輸入 git config --global credential.helper store, 用來在local建立一個config, 方便之後在其他位置不必在輸入config 9.git clone <http_aics-repo> 要求account時, 輸入github的帳戶xxxx@asus.com 要求password時, 輸入步驟6.儲存的token 10.成功後即可clone repo ## stress test with docker 1. Build up Dockerfile ```shell= // at root folder of RAS docker build -t=stress_test -f dockerfiles/Dockerfile.stress_test . ``` 2. Set environment variable Set environment variable, which are needed for request through POKE mechanism. Switch the environment variable scripts to test different service(DEV, Stagging, Prod). ```shell= // for testing DEV source e2e_test/init/setDevEnv.sh // for testing Stagging source e2e_test/init/setStageEnv.sh // for testing Product source e2e_test/init/setProdEnv.sh ``` 3. Run the container **For headless, no website-UI, usage** ```shell= docker run -ti --rm\ --env-file=e2e_test/init/<the_variant_env_file>\ -e USER_NUM=$ROBOT_EMAIL\ -e ROBOT_PWD=$ROBOT_PWD\ -e POKEDEX_URL=$POKEDEX_URL\ --name=stress_test stress_test\ ``` Variable Descriptions: USER_NUM = number of simulate client HATCH_RATE = number of client create per second, before reach USER_NUM TEST_DURATION = total testing time, e.g. 10s 5m30s 1H5m30s ![](https://i.imgur.com/yVzLzJn.png) **For website-UI usage** a. Run stress test in container ```shell= docker run -ti --rm\ --env-file=.env\ -e ROBOT_EMAIL=$ROBOT_EMAIL\ -e ROBOT_PWD=$ROBOT_PWD\ -e POKEDEX_URL=$POKEDEX_URL\ -e POKEBALL_URL=$POKEBALL_URL\ -e POKEBALL_ACCESS_KEY=$POKEBALL_ACCESS_KEY\ -p 8089:8089\ --name=stress_test stress_test\ bash -c "locust -f e2e_test/stress_test.py -H ${POKEBALL_URL}/api/fas" ``` b. Set testing config ![](https://i.imgur.com/5MMlFl0.png) c. Start stress test ![](https://i.imgur.com/pYZdOpb.png) 4. Set different criteria Currently we have two kind of criteria: a. USER_NUM=10 HATCH_RATE=1 TEST_DURATION=15m b. USER_NUM=5 HATCH_RATE=1 TEST_DURATION=20m ``` hint: when you using website-UI, TEST_DURATION should be mannul stopped or you might want to use "timeout" to specify. usage: your_teminal$ timeout 15m <your command here> ```