All Projects → noxdafox → Pebble

noxdafox / Pebble

Licence: lgpl-3.0
Multi threading and processing eye-candy.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pebble

Multitasking
Non-blocking Python methods using decorators
Stars: ✭ 87 (-68.48%)
Mutual labels:  threading, decorators, multiprocessing
Tutorials
机器学习相关教程
Stars: ✭ 9,616 (+3384.06%)
Mutual labels:  threading, multiprocessing
React Native Multithreading
🧵 Fast and easy multithreading for React Native using JSI
Stars: ✭ 164 (-40.58%)
Mutual labels:  threading, multiprocessing
Joblib
Computing with Python functions.
Stars: ✭ 2,620 (+849.28%)
Mutual labels:  threading, multiprocessing
python-graceful-shutdown
Example of a Python code that implements graceful shutdown while using asyncio, threading and multiprocessing
Stars: ✭ 109 (-60.51%)
Mutual labels:  multiprocessing, threading
atpbar
Progress bars for threading and multiprocessing tasks on terminal and Jupyter Notebook
Stars: ✭ 74 (-73.19%)
Mutual labels:  multiprocessing, threading
Fooproxy
稳健高效的评分制-针对性- IP代理池 + API服务,可以自己插入采集器进行代理IP的爬取,针对你的爬虫的一个或多个目标网站分别生成有效的IP代理数据库,支持MongoDB 4.0 使用 Python3.7(Scored IP proxy pool ,customise proxy data crawler can be added anytime)
Stars: ✭ 195 (-29.35%)
Mutual labels:  threading, multiprocessing
think-async
🌿 Exploring cooperative concurrency primitives in Python
Stars: ✭ 178 (-35.51%)
Mutual labels:  multiprocessing, threading
funboost
pip install funboost,python全功能分布式函数调度框架,。支持python所有类型的并发模式和全球一切知名消息队列中间件,python函数加速器,框架包罗万象,一统编程思维,兼容50% python编程业务场景,适用范围广。只需要一行代码即可分布式执行python一切函数。旧名字是function_scheduling_distributed_framework
Stars: ✭ 351 (+27.17%)
Mutual labels:  multiprocessing, threading
Mandelbrot-set-explorer
An interactive Mandelbrot set, made with Python3 and Tkinter
Stars: ✭ 31 (-88.77%)
Mutual labels:  multiprocessing, pool
mantichora
A simple interface to Python multiprocessing and threading
Stars: ✭ 13 (-95.29%)
Mutual labels:  multiprocessing, threading
polog
Логирование должно быть красивым
Stars: ✭ 26 (-90.58%)
Mutual labels:  decorators, threading
LazWebsockets
Websocket Server and Client Library written in Lazarus
Stars: ✭ 51 (-81.52%)
Mutual labels:  threading
Task Worklet
Task Worklet: explainer, polyfill and demos.
Stars: ✭ 257 (-6.88%)
Mutual labels:  threading
pool
Connection pool for Go's grpc client with supports connection reuse.
Stars: ✭ 105 (-61.96%)
Mutual labels:  pool
pooled redis
Simple way to access redis connections without global variables.
Stars: ✭ 18 (-93.48%)
Mutual labels:  pool
Rxweb
Tons of extensively featured packages for Angular, VUE and React Projects
Stars: ✭ 262 (-5.07%)
Mutual labels:  decorators
hyperf-mongodb
基于hyperf的mongodb连接池组件,暂不支持协程
Stars: ✭ 17 (-93.84%)
Mutual labels:  pool
Track-Stargazers
Have fun tracking your project's stargazers
Stars: ✭ 38 (-86.23%)
Mutual labels:  threading
state inspector
State change & method call logger. A debugging tool for instance variables and method calls.
Stars: ✭ 24 (-91.3%)
Mutual labels:  decorators

Pebble

Pebble provides a neat API to manage threads and processes within an application.

:Source: https://github.com/noxdafox/pebble :Documentation: https://pebble.readthedocs.io :Download: https://pypi.org/project/Pebble/

|travis badge| |docs badge|

.. |travis badge| image:: https://travis-ci.org/noxdafox/pebble.svg?branch=master :target: https://travis-ci.org/noxdafox/pebble :alt: Build Status .. |docs badge| image:: https://readthedocs.org/projects/pebble/badge/?version=latest :target: https://pebble.readthedocs.io :alt: Documentation Status

Examples

Run a job in a separate thread and wait for its results.

.. code:: python

from pebble import concurrent

@concurrent.thread
def function(foo, bar=0):
    return foo + bar

future = function(1, bar=2)

result = future.result()  # blocks until results are ready

Run a function with a timeout of ten seconds and deal with errors.

.. code:: python

from pebble import concurrent
from concurrent.futures import TimeoutError

@concurrent.process(timeout=10)
def function(foo, bar=0):
    return foo + bar

future = function(1, bar=2)

try:
    result = future.result()  # blocks until results are ready
except TimeoutError as error:
    print("Function took longer than %d seconds" % error.args[1])
except Exception as error:
    print("Function raised %s" % error)
    print(error.traceback)  # traceback of the function

Pools support workers restart, timeout for long running tasks and more.

.. code:: python

from pebble import ProcessPool
from concurrent.futures import TimeoutError

def function(foo, bar=0):
    return foo + bar

def task_done(future):
    try:
        result = future.result()  # blocks until results are ready
    except TimeoutError as error:
        print("Function took longer than %d seconds" % error.args[1])
    except Exception as error:
        print("Function raised %s" % error)
        print(error.traceback)  # traceback of the function

with ProcessPool(max_workers=5, max_tasks=10) as pool:
    for i in range(0, 10):
        future = pool.schedule(function, args=[i], timeout=3)
        future.add_done_callback(task_done)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].