vendredi 3 septembre 2021

ExpressJs spawn new CPU intensive task on request

This is a system architecture design question, so I'm not sure if it fits here. Excuse me if it doesn't and feel free to suggest the appropriate community.

I have an ExpressJs server and a Python script that runs a CPU intensive task, typically it can take from 30 minutes to 2 hours. I want to allow users to make requests to run that task. After the user makes their request, they should get back a response saying the task is successfully requested and they have to wait for a specific amount of time before making the next request.

My question is, how should I go about invoking that Python script and what do I need to consider, e.g. request timeout, child processes, etc.? What would be considered "best practice" in this situation?

Apologise in advance if this question sounds vague. If you need any more information please comment down below.

Aucun commentaire:

Enregistrer un commentaire