Python脚本如何支持多进程执行?
大家讲道理
大家讲道理 2017-04-18 10:25:23
0
3
575

写了Python脚本用来部署及分发项目到各个节点, 脚本后面跟不同的参数对应不同的项目, 但存在一个问题, 就是我必须等待脚本执行完成才能继续执行下一次部署, 请问大神, 有什么方法能让该脚本同时多进程执行而互不影响? 感谢!

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
黄舟

Self-question and answer, it seems that there is a loophole in my question. In fact, python executes scripts through the python interpreter, and the python interpreter itself is an independent process to perform operations, so I can go anywhere at any time from the client. Execute the script. This question is my problem because I don’t have a clear understanding of the multi-threading application scenario. This question is over, thank you for your attention!

迷茫

You can consider using fabric for deployment. However, multi-node batch deployment can be achieved.

Ty80

There are many ways, for example, you can throw the task directly into celery, or you can program your script into multiple processes/threads, and use set or list to pass parameters

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!