Skip to main content

Run tasks on external processes to overcome Python's global interpreter lock.

Project description

Run tasks on external processes to overcome Python's global interpreter lock.

Inspired by google-research/batch-ppo ExternalProcess

Installation

pip install external

Usage

import external

@external
class Counter():

    def __init__(self, count=0):
        self.count = count

    def increment(self):
        self.count += 1

with Counter(count=1) as c:
    assert c.count.get() == 1
    c.increment()
    assert c.count.get() == 2
    try:
        c.decrement()
    except AttributeError as e:
        print(e)  # 'Counter' object has no attribute 'decrement'
    assert c.count.get() == 2

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

external-0.0.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file external-0.0.1.tar.gz.

File metadata

  • Download URL: external-0.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.20.0 CPython/3.6.4

File hashes

Hashes for external-0.0.1.tar.gz
Algorithm Hash digest
SHA256 79296497a6d404bc39cce7425ccde02f7c6798e09672acde7cfe57ef44b266c8
MD5 99e1e3b90616365f49fbb9588a0e8c00
BLAKE2b-256 8dd821c19c68c616cec27f3ea4c36c4516e56e997d862cfacaa4a5bbe46d19e2

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