# Generated by SnakeBridge v0.13.0 - DO NOT EDIT MANUALLY # Regenerate with: mix compile # Library: dspy 3.1.2 # Python module: dspy.utils.parallelizer # Python class: ParallelExecutor defmodule Dspy.Utils.Parallelizer.ParallelExecutor do @moduledoc """ Wrapper for Python class ParallelExecutor. """ def __snakebridge_python_name__, do: "dspy.utils.parallelizer" def __snakebridge_python_class__, do: "ParallelExecutor" def __snakebridge_library__, do: "dspy" @opaque t :: SnakeBridge.Ref.t() @doc """ Offers isolation between the tasks (dspy.settings) irrespective of whether num_threads == 1 or > 1. Handles also straggler timeouts. ## Parameters - `num_threads` (term() default: None) - `max_errors` (term() default: None) - `disable_progress_bar` (term() default: False) - `provide_traceback` (term() default: None) - `compare_results` (term() default: False) - `timeout` (term() default: 120) - `straggler_limit` (term() default: 3) """ @spec new(list(term()), keyword()) :: {:ok, SnakeBridge.Ref.t()} | {:error, Snakepit.Error.t()} def new(args, opts \\ []) do {args, opts} = SnakeBridge.Runtime.normalize_args_opts(args, opts) SnakeBridge.Runtime.call_class(__MODULE__, :__init__, [] ++ List.wrap(args), opts) end @doc """ Python method `ParallelExecutor._execute_parallel`. ## Parameters - `function` (term()) - `data` (term()) ## Returns - `term()` """ @spec _execute_parallel(SnakeBridge.Ref.t(), term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def _execute_parallel(ref, function, data, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :_execute_parallel, [function, data], opts) end @doc """ Python method `ParallelExecutor._update_progress`. ## Parameters - `pbar` (term()) - `nresults` (term()) - `ntotal` (term()) ## Returns - `term()` """ @spec _update_progress(SnakeBridge.Ref.t(), term(), term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def _update_progress(ref, pbar, nresults, ntotal, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :_update_progress, [pbar, nresults, ntotal], opts) end @doc """ Python method `ParallelExecutor._wrap_function`. ## Parameters - `user_function` (term()) ## Returns - `term()` """ @spec _wrap_function(SnakeBridge.Ref.t(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def _wrap_function(ref, user_function, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :_wrap_function, [user_function], opts) end @doc """ Python method `ParallelExecutor.execute`. ## Parameters - `function` (term()) - `data` (term()) ## Returns - `term()` """ @spec execute(SnakeBridge.Ref.t(), term(), term(), keyword()) :: {:ok, term()} | {:error, Snakepit.Error.t()} def execute(ref, function, data, opts \\ []) do SnakeBridge.Runtime.call_method(ref, :execute, [function, data], opts) end end