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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
wait | bool | no | True | inferred from implementation. |
timeout | Optional[float] | no | None | inferred 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
func | Callable | yes | - | Function to execute for each task |
tasks | List[Any] | yes | - | List of task arguments |
timeout | Optional[float] | no | None | Timeout for individual tasks (overrides default) |
progress_callback | Optional[Callable[[int, int], None]] | no | None | Callback function called with (completed, total) |
preserve_order | bool | no | True | Whether to preserve the original order of results |
**kwargs | inferred from implementation | no | - | 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
func | Callable | yes | - | Function to apply |
iterable | List[Any] | yes | - | Items to process |
chunksize | int | no | 1 | Number of items per chunk |
timeout | Optional[float] | no | None | Timeout 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
func | Callable | yes | - | Function to execute |
*args | inferred from implementation | no | - | Positional arguments |
timeout | Optional[float] | no | None | Timeout for the task |
**kwargs | inferred from implementation | no | - | 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.