fab.steps package#

Predefined build steps with sensible defaults.

fab.steps.step(func)#

Function decorator for steps.

fab.steps.run_mp(config, items, func, no_multiprocessing=False)#

Called from Step.run() to process multiple items in parallel.

For example, a compile step would, in its run() method, find a list of source files in the artefact store. It could then pass those paths to this method, along with a function to compile a single file. The whole set of results are returned in a list-like, with undefined order.

Parameters:
  • items – An iterable of items to process in parallel.

  • func – A function to process a single item. Must accept a single argument.

  • no_multiprocessing (bool) – Overrides the config’s multiprocessing flag, disabling multiprocessing for this call. (default: False)

fab.steps.run_mp_imap(config, items, func, result_handler)#

Like run_mp, but uses imap instead of map so that we can process each result as it happens.

This is useful for a slow operation where we want to save our progress as we go instead of waiting for everything to finish, allowing us to pick up where we left off if the program is halted.

Parameters:
  • items – An iterable of items to process in parallel.

  • func – A function to process a single item. Must accept a single argument.

  • result_handler – A function to handle a single result. Must accept a single argument.

fab.steps.check_for_errors(results, caller_label=None)#

Check an iterable of results for any exceptions and handle them gracefully.

This is a helper function for steps which use multiprocessing, getting multiple results back from run_mp() all in one go.

Parameters:
  • results – An iterable of results.

  • caller_label – Optional human-friendly name of the caller for logging. (default: None)

Subpackages#

Submodules#