trnslator.utils.parallel_process

trnslator.utils.parallel_process(in_dict, function, processors=- 1, use_kwargs=True)[source]

A parallel version of the map function with a progress btr.

Examples

>>> import trnslator as tr
>>> files = ['tests/input_data/problematic/nat_ventilation_SAMPLE0.idf',
>>>          'tests/input_data/regular/5ZoneNightVent1.idf']
>>> wf = 'tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
>>> files = tr.copy_file(files)
>>> rundict = {file: dict(eplus_file=file, weather_file=wf,
>>>                      ep_version=ep_version, annual=True,
>>>                      prep_outputs=True, expandobjects=True,
>>>                      verbose='q', output_report='sql')
>>>           for file in files}
>>> result = parallel_process(rundict, tr.run_eplus, use_kwargs=True)
Parameters
  • in_dict (dict-like) – A dictionary to iterate over.

  • function (function) – A python function to apply to the elements of in_dict

  • processors (int) – The number of cores to use

  • use_kwargs (bool) – If True, pass the kwargs as arguments to function .

Returns

[function(array[0]), function(array[1]), …]