GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BinarSkugga/tentacule: Tentacule is an uncomplicated library to deal with a pool of worker processes

BranchesTags
Open more actions menu

Latest commit

 

History

29 Commits
29 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src/tentacule
src/tentacule
 
 
tests
tests
 
 
.flake8
.flake8
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
deploy.sh
deploy.sh
 
 
noxfile.py
noxfile.py
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

tentacule

Tentacule is an uncomplicated library to deal with a pool of worker processes

How to install

pip install tentacule

How to use

  1. Create a pool and start it
  2. Send a new task to it
  3. Fetch the task result
pool = ProcessPool(workers=3)
pool.start()

def task(arg: int):
    return 2 + arg

task_id = pool.submit(task, 3)
result = pool.fetch(task_id)  # 5

pool.close()

You can also do this in a single step:

pool = ProcessPool(workers=3)
pool.start()

def task(arg: int):
    return 2 + arg

result = pool.submit_and_fetch(task, 5)  # 7

pool.close()

It is possible to stream a generator from a process:

pool = ProcessPool(workers=3)
pool.start()

def task(max: int = 10):
    for i in range(max):
        yield i

for result in pool.submit_and_stream(task):
    print(result)  # Will print 0 through 9 inclusively

pool.close()

Restrictions

  • Anything dill can't pickle, can't be used as a task.
  • Arguments are pickled using the regular pickling for processes.

About

Tentacule is an uncomplicated library to deal with a pool of worker processes

Topics

multiprocessingparallelpoolprocesspythonstreaming-dataworker-poolworkers

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.