Module: sarpyx.utils.executor

File: sarpyx/utils/executor.py

No module docstring available; module purpose is inferred from implementation.

Exported Symbols (__all__)

No explicit __all__ list. Public symbols inferred from implementation.

Public Functions (0)

No public top-level functions detected.

Public Classes (1)

MultiprocessExecutor class

An enhanced multiprocess executor class for parallel task execution. Features: - Context manager support - Progress tracking - Timeout handling - Error recovery - Result ordering preservation

File location: sarpyx/utils/executor.py:17

Class Signature

class MultiprocessExecutor

Constructor Parameters

Return Type

MultiprocessExecutor instances.

Exceptions

Construction/runtime exceptions are inferred from implementation and method-level documentation.

Side Effects

See method-level side effects below.

Example Usage

from sarpyx.utils.executor import MultiprocessExecutor

obj = MultiprocessExecutor(...)  # inferred from implementation

Edge Cases

No class-level edge-case section is explicitly documented; rely on method-level checks and raised exceptions.

Public Methods (4)

MultiprocessExecutor.shutdown method

Gracefully shutdown the executor.

File location: sarpyx/utils/executor.py:58

Signature

shutdown(self, wait: bool=True, timeout: Optional[float]=None)

Parameters

ParameterTypeRequiredDefaultDescription
waitboolnoTrueinferred from implementation.
timeoutOptional[float]noNoneinferred from implementation.

Return Type

inferred from implementation

inferred from implementation.

Exceptions

None explicitly documented; inferred from implementation.

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.executor import MultiprocessExecutor

# Constructor arguments are inferred from implementation.
obj = MultiprocessExecutor(...)  # inferred from implementation
result = obj.shutdown()

Edge Cases

Includes optional parameters with implementation-defined fallback behavior.

MultiprocessExecutor.execute_tasks method

Execute multiple tasks in parallel with enhanced features.

File location: sarpyx/utils/executor.py:68

Signature

execute_tasks(self, func: Callable, tasks: List[Any], timeout: Optional[float]=None, progress_callback: Optional[Callable[[int, int], None]]=None, preserve_order: bool=True, **kwargs) -> List[Any]

Parameters

ParameterTypeRequiredDefaultDescription
funcCallableyes-Function to execute for each task
tasksList[Any]yes-List of task arguments
timeoutOptional[float]noNoneTimeout for individual tasks (overrides default)
progress_callbackOptional[Callable[[int, int], None]]noNoneCallback function called with (completed, total)
preserve_orderboolnoTrueWhether to preserve the original order of results
**kwargsinferred from implementationno-Additional keyword arguments for the function

Return Type

List[Any]

List of results from task execution

Exceptions

  • RuntimeError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.executor import MultiprocessExecutor

# Constructor arguments are inferred from implementation.
obj = MultiprocessExecutor(...)  # inferred from implementation
result = obj.execute_tasks(func=<func>, tasks=<tasks>)

Edge Cases

May raise: RuntimeError. Includes optional parameters with implementation-defined fallback behavior.

MultiprocessExecutor.map method

Apply function to every item in iterable in parallel with timeout support.

File location: sarpyx/utils/executor.py:163

Signature

map(self, func: Callable, iterable: List[Any], chunksize: int=1, timeout: Optional[float]=None) -> List[Any]

Parameters

ParameterTypeRequiredDefaultDescription
funcCallableyes-Function to apply
iterableList[Any]yes-Items to process
chunksizeintno1Number of items per chunk
timeoutOptional[float]noNoneTimeout for the entire operation

Return Type

List[Any]

List of results

Exceptions

  • RuntimeError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.executor import MultiprocessExecutor

# Constructor arguments are inferred from implementation.
obj = MultiprocessExecutor(...)  # inferred from implementation
result = obj.map(func=<func>, iterable=<iterable>)

Edge Cases

May raise: RuntimeError. Includes optional parameters with implementation-defined fallback behavior.

MultiprocessExecutor.submit_single method

Submit a single task and wait for result.

File location: sarpyx/utils/executor.py:210

Signature

submit_single(self, func: Callable, *args, timeout: Optional[float]=None, **kwargs) -> Any

Parameters

ParameterTypeRequiredDefaultDescription
funcCallableyes-Function to execute
*argsinferred from implementationno-Positional arguments
timeoutOptional[float]noNoneTimeout for the task
**kwargsinferred from implementationno-Keyword arguments

Return Type

Any

Task result

Exceptions

  • RuntimeError

Side Effects

  • inferred from implementation

Example Usage

from sarpyx.utils.executor import MultiprocessExecutor

# Constructor arguments are inferred from implementation.
obj = MultiprocessExecutor(...)  # inferred from implementation
result = obj.submit_single(func=<func>)

Edge Cases

May raise: RuntimeError. Includes optional parameters with implementation-defined fallback behavior.