【文件属性】:
文件名称:llll:并行执行您的python任务
文件大小:10KB
文件格式:ZIP
更新时间:2021-04-29 00:34:08
Python
llll
轻松并行执行python任务。
安装
git clone https://github.com/ctmakro/llll
cd llll
pip install -e .
用法
启动一个子进程,并通过回调异步地从其stdout收集每一行。
回调将从一个单独的线程启动。
from llll import Subprocess
import sys , time
def decode_and_print ( bytes ):
sys . stdout . write ( bytes . decode ( 'utf-8' ))
sys . stdout . flush ()
s = Subprocess (
[ 'ping' , 'baidu.com' ],
# args
stdout_callback = decode_and_print ,
stder
【文件预览】:
llll-master
----llll()
--------python_instance.py(2KB)
--------pool.py(3KB)
--------tests.py(2KB)
--------__init__.py(218B)
--------sbc.py(3KB)
--------sp.py(5KB)
----setup.py(3KB)
----.gitignore(58B)
----readme.md(4KB)