Improve Python code (multiprocessing, asyncio, threading) + docker
Budget: $30 – $250 USD
Improve Python code:
1. The code gets a parameter at startup - % CPU load. The default is 50% and it uses it to work;
2. Add processing of several tasks at once (until we load the processor to the target value)
3. The code loads "models" - if the model fails to load or start - roll back to a previous version
4. "Reuse" loaded models in memory (due to slow initialization)
5. Save all the code in one file
6. Correct display of the current state taking into account multithreading
7. If a thread freezes, it's forced to terminate after an hour or so.
8. Unloading unused models from the memory after an hour of inactivity
9. For docker image if the server doesn't transfer new tasks during XX minutes - stop and unload everything
10. Temporary files (e.g. downloaded audio) - carefully delete (taking into account multithreading)
11. Do not send requests to the socket unnecessarily.
Comment: the server returns the ID of the next task after "next" request, within a few seconds. If there is no answer, no task (as soon as it appears, the server sends a new command itself, without any request from the client).
The image for the PC must work all the time and in case of failure be restored.
Control the use of RAM: vosk can consume a lot of resources
Socket Server for testing build itself (the logic is simple: after receiving next command gives a new task (or not), also gives a new task immediately after the connection (if any)
1. The code gets a parameter at startup - % CPU load. The default is 50% and it uses it to work;
2. Add processing of several tasks at once (until we load the processor to the target value)
3. The code loads "models" - if the model fails to load or start - roll back to a previous version
4. "Reuse" loaded models in memory (due to slow initialization)
5. Save all the code in one file
6. Correct display of the current state taking into account multithreading
7. If a thread freezes, it's forced to terminate after an hour or so.
8. Unloading unused models from the memory after an hour of inactivity
9. For docker image if the server doesn't transfer new tasks during XX minutes - stop and unload everything
10. Temporary files (e.g. downloaded audio) - carefully delete (taking into account multithreading)
11. Do not send requests to the socket unnecessarily.
Comment: the server returns the ID of the next task after "next" request, within a few seconds. If there is no answer, no task (as soon as it appears, the server sends a new command itself, without any request from the client).
The image for the PC must work all the time and in case of failure be restored.
Control the use of RAM: vosk can consume a lot of resources
Socket Server for testing build itself (the logic is simple: after receiving next command gives a new task (or not), also gives a new task immediately after the connection (if any)