Merge stable branches in master, resolve issues
Copy locally all ./pretrained_models to correct locations
For testing purposes make sure that your host machine connects to real database (do not use this for development). Put breakpoint and run this script to make sure it works correctly

Make sure that production database contains ALL changes in DB necessary, modifications in columns from apidev or workers data etc. If new features added need to add also to production. For example:

Run in separate CMD window locally python ./worker_feature_coordinator.py
To avoid disrupting production workers column host_name only workers with same host_name gets grouped and assigned files that are available in system controllers.controller_database.ControllerDatabase.get_tasks_by_feature, very important check is_file_available_on_this_machine
Run in another separate CMD window locally python ./api.py

Submit example task form BPO calls, pick randomly call with +2min and known speaker ID, unknown language, select ALL audio features to test, for example
BPO api_key: 3e995f31-f686-450c-8364-010ca85262fb
http://127.0.0.1:8000/docs#/default/task_submit_task_submit_post
https://dev.pitchpatterns.com/conversation/a3481319-094a-48b6-ab44-baa8d6bc474b
Use specific known user_id , Download audio form side panel in Dev mode

When submitting set email to receive final result
Copy down task_uuid

When video models available, then also pick random video Call with +2min from Asya team to process ALL audio + video features
asya team api_key: AFB6B3E4-6688-471E-AE6C-12C5242B61C5
Run one by one each of workers in required order (they will appear in coordinator and should process input), determined by features order_idx


If everything is correct you should be able to run one by one each worker and coordinator in another CMD tab. Run and stop each worker
If task gets FAILED during testing you can reset it’s state in tasksand features_in_task tables by task_uuid, Fix any bugs and commit in GIT
Validate result in test javascript tool
Before building make mamba environments and test locally mamba env create -f env_common.yaml, Maintain environment_common.yaml for each worker if necessary (might be that some workers might not work with same environment) in worker startup script include info which env need to be used. For example environment_audio_energy.yaml is used for audio_energy
Make sure you change correctly all records in model_versions.json
Make sure that environment running docker_builder.py have basic requirements pip install docker-py
run script python ./docker_builder.py -feature {feature}, replace {feature} with each of
audio_denoise
audio_diarisation
audio_tempo
audio_energy
audio_emotions
audio_language_detection
audio_text
Result tar file will be located in ./dockers/audio_denoise.tar (for example)
📗 You can also use docker_builder.sh to build multiple docker images at once
⚠️ This file can 10GB+ large
Useful commands will be generated in CMD line, copy for usage
Copy ./dockers/audio_denoise.tar to target machine
On target machine make sure you install apt-get docker NOT snap or other kind. Must use nvidia-version of docker
11sudo apt install curl
11distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
11sudo apt-get update
11sudo apt-get install -y nvidia-docker2
11sudo systemctl restart docker
Docker must work without sudo
11sudo chmod a+wrx /var/run/docker.sock
target machine must have also nvidia-smi drivers and cuda installed, as well as fuse3
Make sure docker is running
11systemctl status docker
On target machine load in docker image
21docker load -i ./dockers/audio_diarisation.tar2docker load -i ./src/audio_denoise_cuda_0.tarLaunch docker:
xxxxxxxxxx11docker run --detach --hostname api.asya.ai --env CUDA_VISIBLE_DEVICES=0 --privileged --gpus all -e DEVICE=cuda -e LANG_CODES="lv" --device /dev/fuse --name audio_denoise audio_denoise
When running connect to container:
xxxxxxxxxx31docker exec -it audio_diarisation bash2screen -rd worker3exitCheck if worker available in features_workers with correct hostname api.asya.ai wait for coordinator to give job to worker

If existing container running kill it using
Go inside and terminate worker, so that it removes it from api DB, do not just force kill it!
from target machine docker kill audio_text (audio_text is docker name not image)
To delete existing container docker rm audio_text (or some other using docker container ls)
Orther docker commands available here: http://share.yellowrobot.xyz/quick/2023-3-28-08441FD2-72B9-4879-8D97-BE4FF565F10E.html
If cuda not working in docker can check using torch
xxxxxxxxxx21micromamba activate env_common2pythonxxxxxxxxxx21import torch2torch.cuda.is_available()If docker works only as sudo can enable all users using
xxxxxxxxxx11sudo chmod a+wrx /var/run/docker.sock
Only copy models that are required by controllers and do not include huggingface, torch hub/cloud models they will be downloaded when starting workers.
Only include in copy files that are needed
{copy_models}
SSH keys only work with chomd 600
RUN chmod 600 /app/keys/oracle-4-p100.key
RUN - shell commands executed in sequence, better to combine as many as possible to have option to cache data
COPY - coppies files and directories to target image, executed in sequence, ⚠️ Very important to use with .dockerignore , because docker will include all files in ./Dockerfile root without it regardless of COPY commands
CMD - startup script shell
there can only be one CMD instruction in a Dockerfile. If more than one CMD instruction is listed, only the last CMD will take effect only single last CMD will be executed in
Cleanup as much as you can in docker image to reduce size
xxxxxxxxxx21RUN apt-get clean && \2rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Mofiyable parameters
x1# we need to specify default values2ENV ENVIRONMENT=production3ENV CLUSTER=14
5# there is no need to use parameters array6CMD node server.js ${CLUSTER} ${ENVIRONMENT}then wehn running can pass with -e
xxxxxxxxxx11$ docker run -d -p 9000:9000 -e ENVIRONMENT=dev -e CLUSTER=0 -me/appWhen running docker run
xxxxxxxxxx11docker run --detach --name asya_backend --publish 8080:8080 asya_backend
Multiple ports each have –publish in front
When running (not need to create folders beforehand)
xxxxxxxxxx11docker run --detach --name asya_backend --volume /Users/evalds/Documents/alarm_watchdog_backend_mobile_app/MAPS:/app/MAPS asya_backend
Multiple volumes each have –volume in front
Important to have .dockerignore, othewise will copy ALL files from directory in container
xxxxxxxxxx131*2!Dockerfile3!controllers/**4!models/**5!denoiser/**6!modules/**7!keys/**8!modules_core/**9!modules_ext/**10!./*.py11!./*.sh12!./*.json13!./*.yaml
xxxxxxxxxx91def loguru_docker(msg):2 DOCKER_LOG_STDOUT = '/proc/1/fd/1'3 if os.path.exists(DOCKER_LOG_STDOUT):4 with open(DOCKER_LOG_STDOUT, 'a') as f:5 f.write(msg + '\n')6
7if __name__ == '__main__':8 logger.add(sink='./logs/worker__{time:YYYY-MM-DD}.log', rotation='00:00')9 logger.add(sink=loguru_docker)