Skip to main content

store it

Project description

simple worker

Note: this package is still in alpha. Use with caution !

Quickstart

Install worker:

pip install worker

Use worker:

data = [
           {'hello': 'world'},
       ] * 40
info = {
    'worker': 'xxx.yyy.worker_do_sth'
}
worker = Worker(mode='thread')
resp = worker.work(data, info)
print(resp)
def worker_do_sth(data, info):
    print(data)
    return data

def callback(results):
    print('final')
    print(results)


def test_celery():
    data = [
               'u11', 'u22', 'u33', 'u44',
               'u21', 'u22', 'u23', 'u24',
               'u31', 'u32', 'u33', 'u34',
               'u41', 'u42', 'u43', 'u44',
               'u51', 'u52', 'u53', 'u54',
           ]*8
    info={
        'celery_worker': 'test.functional.test_celery.simple',
        'worker': 'test.functional.test_celery.worker_do_sth',
        'celery_max_workers': 4,
        'celery_chunk_size': 80,
        'chunk_size': 20,
        'final_callback': 'test.functional.test_celery.callback',
        'queue': '123'
    }

    worker = Worker(mode='celery')
    resp = worker.work(data, info)
    return resp

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

worker-2018.3.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file worker-2018.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for worker-2018.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 394eefddba9cfb440a653708044ed17d5a2a082c2a4d28dbeefa170b400313a6
MD5 89341d801ac874d0fafb81784b10594f
BLAKE2b-256 5b9df0e95267c8b50bff7cf14204d7830564750eac32884d2d9474a1eb8b76b2

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