All Projects → rohanpm → more-executors

rohanpm / more-executors

Licence: GPL-3.0 license
Library of composable Python executors

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to more-executors

stream-throttle
Rust Stream combinator, to limit the rate at which items are produced
Stars: ✭ 19 (+5.56%)
Mutual labels:  futures
ig-markets
IG Markets API wrapper for Node.js
Stars: ✭ 23 (+27.78%)
Mutual labels:  futures
unicycle
A futures abstraction that runs a set of futures which may complete in any order
Stars: ✭ 73 (+305.56%)
Mutual labels:  futures
pg async.rs
Asynchronous, HA (master-master) PostgreSQL driver on top of libpq.
Stars: ✭ 40 (+122.22%)
Mutual labels:  futures
python3-concurrency
Python3爬虫系列的理论验证,首先研究I/O模型,分别用Python实现了blocking I/O、nonblocking I/O、I/O multiplexing各模型下的TCP服务端和客户端。然后,研究同步I/O操作(依序下载、多进程并发、多线程并发)和异步I/O(asyncio)之间的效率差别
Stars: ✭ 49 (+172.22%)
Mutual labels:  futures
akshare
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
Stars: ✭ 5,155 (+28538.89%)
Mutual labels:  futures
FutureBuilderWithPagination
we're gonna look out how to work with Future Builder and show the result in GridView. We'll also see how to use Pagination with Future Builder.Future Builder is a widget that returns another widget based on futures execution result. It builds itself based on the latest AsyncSnapshots.
Stars: ✭ 45 (+150%)
Mutual labels:  futures
showme
Rapid diagnostic system status tool (performance monitoring, network scanning, mysql performance monitoring, kubectl status)
Stars: ✭ 24 (+33.33%)
Mutual labels:  executors
finam-export
Python client library to download historical data from finam.ru
Stars: ✭ 84 (+366.67%)
Mutual labels:  futures
variadic future
Variadic, completion-based futures for C++17
Stars: ✭ 41 (+127.78%)
Mutual labels:  futures
open-md-gateway
Diff协议行情网关, 支持实时行情和历史行情
Stars: ✭ 18 (+0%)
Mutual labels:  futures
BeauRoutine
Coroutine and tweening framework for Unity3D
Stars: ✭ 88 (+388.89%)
Mutual labels:  futures
swift-futures
Demand-driven asynchronous programming in Swift
Stars: ✭ 32 (+77.78%)
Mutual labels:  futures
futures-fs
Access File System operations off-thread, using a Futures.
Stars: ✭ 64 (+255.56%)
Mutual labels:  futures
future.callr
🚀 R package future.callr: A Future API for Parallel Processing using 'callr'
Stars: ✭ 52 (+188.89%)
Mutual labels:  futures
PromisedFuture
A Swift based Future/Promises framework to help writing asynchronous code in an elegant way
Stars: ✭ 75 (+316.67%)
Mutual labels:  futures
aws-utils
This repository provides utilities which are used at MiQ.
Stars: ✭ 20 (+11.11%)
Mutual labels:  executors
openctp
CTP开放平台提供A股、港股、美股、期货、期权等全品种接入通道,通过提供中泰证券XTP、华鑫证券奇点、东方证券OST、东方财富证券EMT、盈透证券TWS等各通道的CTPAPI接口,CTP程序可以无缝对接各股票柜台。平台也提供了一套基于TTS交易系统的模拟环境,同样提供了CTPAPI兼容接口,可以替代Simnow,为CTP量化交易开发者提供7x24可用的模拟环境。
Stars: ✭ 389 (+2061.11%)
Mutual labels:  futures
future.mapreduce
[EXPERIMENTAL] R package: future.mapreduce - Utility Functions for Future Map-Reduce API Packages
Stars: ✭ 12 (-33.33%)
Mutual labels:  futures
ray tutorial
An introductory tutorial about leveraging Ray core features for distributed patterns.
Stars: ✭ 67 (+272.22%)
Mutual labels:  futures

more-executors

A library of composable Python executors and futures.

Build Status Maintainability Test Coverage

This library is intended for use with the concurrent.futures module. It includes a collection of Executor implementations in order to extend the behavior of Future objects.

Features

  • Futures with implicit retry
  • Futures with implicit cancel on executor shutdown
  • Futures with implicit cancel after timeout
  • Futures with transformed output values (sync & async)
  • Futures resolved by a caller-provided polling function
  • Throttle the number of futures running at once
  • Synchronous executor
  • Bridge concurrent.futures with asyncio
  • Convenience API for creating executors
  • Instrumented with Prometheus

See the API documentation for detailed information on usage.

Example

This example combines the map and retry executors to create futures for HTTP requests running concurrently, decoding JSON responses within the future and retrying on error.

import requests
from concurrent.futures import as_completed
from more_executors import Executors


def get_json(response):
    response.raise_for_status()
    return (response.url, response.json())


def fetch_urls(urls):
    # Configure an executor:
    # - run up to 4 requests concurrently, in separate threads
    # - run get_json on each response
    # - retry up to several minutes on any errors
    executor = Executors.\
        thread_pool(max_workers=4).\
        with_map(get_json).\
        with_retry()

    # Submit requests for each given URL
    futures = [executor.submit(requests.get, url)
               for url in urls]

    # Futures API works as normal; we can block on the completed
    # futures and map/retry happens implicitly
    for future in as_completed(futures):
        (url, data) = future.result()
        do_something(url, data)

Development

virtualenv and pip may be used to locally install this project from source:

virtualenv ~/dev/python
. ~/dev/python/bin/activate

git clone https://github.com/rohanpm/more-executors
cd more-executors

pip install --editable .

Autotests may be run with pytest:

pip install -r test-requirements.txt
py.test

Submit pull requests against https://github.com/rohanpm/more-executors.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

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].