libearth
latest
  • libearth — The shared common library for Earth Reader apps
    • libearth.codecs — Common codecs
    • libearth.compat — Compatibility layer
    • libearth.compat.etree — ElementTree compatibility layer
    • libearth.xml.compat.clrxmlreader — XML parser implementation for CLR
    • libearth.compat.parallel — Threading-related compatibility layer
    • libearth.compat.xmlpullreader — Pulling SAX parser
    • libearth.crawler — Crawler
    • libearth.defaults — Default data for initial state of apps
    • libearth.feed — Feeds
    • libearth.parser — Parsing various RSS formats
    • libearth.repository — Repositories
    • libearth.sanitizer — Sanitize HTML tags
    • libearth.schema — Declarative schema for pulling DOM parser of XML
    • libearth.session — Isolate data from other installations
    • libearth.stage — Staging updates and transactions
    • libearth.subscribe — Subscription list
    • libearth.tz — Basic timezone implementations
    • libearth.version — Version data
  • Goal
  • Core concepts
  • How to contribute
  • Libearth Changelog
libearth
  • Docs »
  • libearth — The shared common library for Earth Reader apps »
  • libearth.compat.parallel — Threading-related compatibility layer
  • Edit on GitHub

libearth.compat.parallel — Threading-related compatibility layer¶

libearth.compat.parallel.cpu_count()¶

Get the number of CPU cores.

Returns:the number of cpu cores
Return type:numbers.Integral
libearth.compat.parallel.parallel_map(pool_size, function, iterable, *iterables)¶

Parallel vesion of builtin map() except of some differences:

  • It takes a more argument at first: pool_size.
  • The function applications will be done in parallel.
  • The order of arguments to results are not maintained. You should treat these as a set.
  • The result is a lazy iterable. Although the function immediately returns an iterable, it might block if some results are not completely ready when it’s iterated.
Parameters:
  • pool_size (numbers.Integral) – the number of workers
  • function (collections.Callable) – the function to apply iterables as its arguments
  • iterable (collections.Iterable) – function argument values
Returns:

a promise iterable to future results

Return type:

collections.Iterable

Changed in version 0.1.1: Errored values are raised at the lastest.

Next Previous

© Copyright 2013, Hong Minhee. Revision 71d2f324.

Built with Sphinx using a theme provided by Read the Docs.