def test_channel_shim(): v = tuple(int(x) for x in gevent.__version__.split('.')) if v >= (0, 13, 0) and v < (1, 0, 0): assert isinstance(channel.Channel(), queue.Queue) elif v >= (1, 0, 0): assert isinstance(channel.Channel(), queue.Channel) else: assert False, 'Unexpected version ' + gevent.__version__
def __init__(self, transferer): # Injected transfer mechanism self.transferer = transferer # Synchronization and tasks self.wait_change = channel.Channel() self.expect = 0 self.closed = False # Maintain a list of running greenlets for gevent.killall. # # Abrupt termination of WAL-E (e.g. calling exit, as seen with # a propagated error) will not result in clean-ups # (e.g. 'finally' clauses) being run, so it's necessary to # retain the greenlets, inject asynchronous exceptions, and # then wait on termination. self.greenlets = set([])
def __init__(self, uploader, max_concurrency, max_members=tar_partition.PARTITION_MAX_MEMBERS): # Injected upload mechanism self.uploader = uploader # Concurrency maximums self.max_members = max_members self.max_concurrency = max_concurrency # Current concurrency burden self.member_burden = 0 # Synchronization and tasks self.wait_change = channel.Channel() self.closed = False # Used for both synchronization and measurement. self.concurrency_burden = 0