Package Products :: Package ZenUtils :: Module zencatalog |
[hide private]
[frames] | no frames]

# Module zencatalog

source code

Classes | [hide private]
DisconnectedDuringGenerator A special exception that can be yielded during a generator and watched for.
ZenCatalog

Functions | [hide private]
chunk(iterable, callback, reconnect_cb=lambda: None, size=1, delay=1) Iterate through a generator, splitting it into chunks of size `size`, calling `callback(chunk)` on each. | source code

Variables | [hide private]
| log = `logging.getLogger("zen.Catalog")`
| HIGHER_THAN_CRITICAL = `100`
| CHUNK_SIZE = `100`

Function Details | [hide private]

### chunk(iterable, callback, reconnect_cb=lambda: None, size=1, delay=1) | source code
Iterate through a generator, splitting it into chunks of size `size`, calling `callback(chunk)` on each. In case of a DisconnectedDuringGenerator, pause for `delay` seconds, then call `reconnect_cb` and continue with the iteration. This is used to walk through the database object by object without dying if the database goes away or there's a `ConflictError`.