utils.time_limit#

utils.time_limit(function, max_execution_time, *args, **kwargs)[source]#

Assert a maximal time limit on functions with potentially problematic / unbounded execution times.

Warning

This function launches a daemon process.

Parameters:
  • function (callable) – The function to run under the time limit.

  • max_execution_time (float) – The maximum runtime in seconds.

  • args – arguments to pass to the function.

  • kwargs (optional) – keyword arguments to pass to the function.