0

I am new in django and Python. So I am using angular 7 in front-end and django for API's. So I want to achieve parallel processing.

Scenario: I have some script name's that I will send to python for execution and python should execute those scripts(script may take different time to execute like some script will take 10 sec and some will take 20 sec). I want all the script should execute simultaneously and once anyone of those will finish it should send response back to angular. So that I don't need to wait for all the script to execute. As I know we can achieve this using sockets. but I want to know the best way of doing this. Note: I don't need any code here, just want some guideline how to achieve this.

Thanks

  • if you want to run parallel python scripts, you need to use `subprocess.call`. Be aware that these processes cannot communicate in general. – man zet Dec 27 '19 at 09:57
  • Maybe threading is an approach. This [post](https://stackoverflow.com/questions/17601698/can-django-do-multi-thread-works) might provide some hints – Chris Dec 27 '19 at 12:32
  • Any Idea the process from angular to python, I meant how to send request from front end and how python will respond, Will it be multiple post request and a single API with different parameters?? – user3756907 Dec 30 '19 at 05:58

1 Answers1

0

you can use forkJoin to achieve this functionality. https://www.learnrxjs.io/operators/combination/forkjoin.html