{"id":37641538,"url":"https://github.com/ftpsolutions/collapsing-thread-pool-executor","last_synced_at":"2026-01-16T11:18:31.259Z","repository":{"id":62563495,"uuid":"125473462","full_name":"ftpsolutions/collapsing-thread-pool-executor","owner":"ftpsolutions","description":"A take on the concurrent.futures.thread.ThreadPoolExecutor that self-manages the number of threads","archived":false,"fork":false,"pushed_at":"2020-08-18T13:46:45.000Z","size":25,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-01-06T00:52:53.088Z","etag":null,"topics":["mit-license","python","python3","threadpoolexecutor"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ftpsolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-16T06:27:52.000Z","updated_at":"2024-11-28T16:33:49.000Z","dependencies_parsed_at":"2022-11-03T15:45:17.558Z","dependency_job_id":null,"html_url":"https://github.com/ftpsolutions/collapsing-thread-pool-executor","commit_stats":null,"previous_names":["initialed85/collapsing-thread-pool-executor"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ftpsolutions/collapsing-thread-pool-executor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ftpsolutions%2Fcollapsing-thread-pool-executor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ftpsolutions%2Fcollapsing-thread-pool-executor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ftpsolutions%2Fcollapsing-thread-pool-executor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ftpsolutions%2Fcollapsing-thread-pool-executor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ftpsolutions","download_url":"https://codeload.github.com/ftpsolutions/collapsing-thread-pool-executor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ftpsolutions%2Fcollapsing-thread-pool-executor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mit-license","python","python3","threadpoolexecutor"],"created_at":"2026-01-16T11:18:30.531Z","updated_at":"2026-01-16T11:18:31.246Z","avatar_url":"https://github.com/ftpsolutions.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CollapsingThreadPoolExecutor\n\nThe CollapsingThreadPoolExecutor is inspired by and compatible with the ThreadPoolExecutor from the\n\"futures\" module, it operates differently in that worker threads are handled with a stack which results in the same worker or workers doing all the work (and idle workers being destroyed).\n\n## How to install\n\n    $ pip install collapsing-thread-pool-executor\n\n## How to develop\n\n**Prerequisites**\n\n* python3 w/ pip\n* python2 w/ pip\n* virtualenvwrapper\n* entr\n\n**Set up the environments**\n\n    $ mkvirtualenv -p `which python2.7` collapsing-thread-pool-executor-py2\n    $ pip install .\n    $ pip install -r requirements.txt\n\n    $ mkvirtualenv -p `which python3` collapsing-thread-pool-executor-py3\n    $ pip install .\n    $ pip install -r requirements.txt\n\n**Watch the tests**\n\n    # watch python2 tests in one window\n    $ workon collapsing-thread-pool-executor-py2\n    $ find ./ -name '*.py' | entr -c py.test -v --log-level=DEBUG collapsing_thread_pool_executor\n    \n    # watch python3 tests in one window\n    $ workon collapsing-thread-pool-executor-py3\n    $ find ./ -name '*.py' | entr -c py.test -v --log-level=DEBUG collapsing_thread_pool_executor\n\n## Examples\n\nThe example below will execute `some_task()` 100 times; as `some_task()` should take a second to execute and as we've allocated 10 workers, the whole thing should take about 10 seconds.\n\n    import time\n\n    from collapsing_thread_pool_executor import CollapsingThreadPoolExecutor\n\n    def some_task():\n        time.sleep(1)\n\n    # all arguments are optional\n    pool = CollapsingThreadPoolExecutor(\n        workers=10,\n        thread_name_prefix='SomePool',\n        permitted_thread_age_in_seconds=60,\n    )\n\n    for i in range(0, 100):\n        pool.submit(some_task)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fftpsolutions%2Fcollapsing-thread-pool-executor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fftpsolutions%2Fcollapsing-thread-pool-executor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fftpsolutions%2Fcollapsing-thread-pool-executor/lists"}