yaybu/yay — pull request #13 by Jc2k (2014-01-26 13:06:27+00:00)
Title: Add a gevent based resolving process

This PR adds a gevent based resolver. This means that each ``Node.resolve``, ``Node.expand``, ``Node.get_context`` and ``Node.get_key`` operation occurs in it's own 'Greenlet'.

An AsyncResult is cached for each Operation, which means that if the same operation is requested again then that branch of execution is paused until a result is available. Dependencies (both who depends on this operation, and which operations does this operation depend on) are recorded. This allows CycleErrors and ParadoxErrors to be detected.

The "peeking" behaviour seen in this example::

foo: bar
if foo:
baz: qux

Is also understood at the Operation level, and any operations cause by testing 'foo' and their dependencies will be evicted from the cache. They will then be retested for paradoxes.

When any ``Dictish`` type is resolved, Yay will resolve all keys at once in separate greenlets using the ``Pool.imap_unordered`` feature of gevent. In Yaybu this can be used to allow gevent powered operations (such as subprocess and socket operations) to not block Yay evaluation. The effect of this is implicit parallel execution of I/O bound operations.

Unfortunately, this branch currently only supports Python 2.6, 2.7 and 3.2. Gevent master is required to support 3.2, Gevent master seems broken for 3.3 and whilst gevent is supported on pypy it is not robustly packaged yet.

How badly did i reduce coverage, coverage bot :-)?