Skip to main content

aiojobs maintained fork

Project description

Important

This is a manintained fork of an abandoned package. The original aiojobs package is written by Andrew Svetlov. The purpose of this fork is to merge open pull requests that were open for a very long time without any feedback from the maintainer side.

aiojobs

https://travis-ci.org/aio-libs/aiojobs.svg?branch=master https://codecov.io/gh/aio-libs/aiojobs/branch/master/graph/badge.svg https://img.shields.io/pypi/v/aiojobs.svg Documentation Status Chat on Gitter

Jobs scheduler for managing background task (asyncio)

The library gives controlled way for scheduling background tasks for asyncio applications.

Installation

$ pip3 install aiojobs

Usage example

import asyncio
import aiojobs

async def coro(timeout):
    await asyncio.sleep(timeout)

async def main():
    scheduler = await aiojobs.create_scheduler()
    for i in range(100):
        # spawn jobs
        await scheduler.spawn(coro(i/10))

    await asyncio.sleep(5.0)
    # not all scheduled jobs are finished at the moment

    # gracefully close spawned jobs
    await scheduler.close()

asyncio.get_event_loop().run_until_complete(main())

Integration with aiohttp.web

from aiohttp import web
from aiojobs.aiohttp import setup, spawn

async def handler(request):
    await spawn(request, coro())
    return web.Response()

app = web.Application()
app.router.add_get('/', handler)
setup(app)

or just

from aiojobs.aiohttp import atomic

@atomic
async def handler(request):
    return web.Response()

For more information read documentation: https://aiojobs.readthedocs.io

Communication channels

aio-libs google group: https://groups.google.com/forum/#!forum/aio-libs

Feel free to post your questions and ideas here.

Gitter Chat https://gitter.im/aio-libs/Lobby

We support Stack Overflow. Please add python-asyncio or aiohttp tag to your question there.

Author and License

The aiojobs package is written by Andrew Svetlov.

It’s Apache 2 licensed and freely available.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiojobs-fork-1.1.0.tar.gz (136.2 kB view details)

Uploaded Source

Built Distribution

aiojobs_fork-1.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file aiojobs-fork-1.1.0.tar.gz.

File metadata

  • Download URL: aiojobs-fork-1.1.0.tar.gz
  • Upload date:
  • Size: 136.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for aiojobs-fork-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ce818a66120be1d1c77d4660d4182ec10ececd29d1821e2d89a5279eb6d480ef
MD5 65b446b698f1351a95139269860dc35f
BLAKE2b-256 a4e1a6a6c7780df97ec4ee2a8810e8b1b534d195df1e3b21bce3dc6c92cae58a

See more details on using hashes here.

File details

Details for the file aiojobs_fork-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aiojobs_fork-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7839e02b630fbc3eb52e4a9d14321a53a2b8b6b63a3fb34b3d672714ab28fcf0
MD5 142f85119c7e3033a5a74810e495ae91
BLAKE2b-256 98d02a5d90f2e299621192586946f10ac3caa7023084b78fd964bde2c9ccf89c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page