pynenc.runner.persistent_process_runner¶
Module Contents¶
Classes¶
PersistentProcessRunner maintains a fixed number of processes that continuously run tasks. |
Functions¶
Main function for persistent process that executes invocations sequentially. |
API¶
- pynenc.runner.persistent_process_runner.persistent_process_main(app: pynenc.app.Pynenc, *, process_key: str, runner_cache: dict, stop_event: multiprocessing.synchronize.Event) None[source]¶
Main function for persistent process that executes invocations sequentially.
- class pynenc.runner.persistent_process_runner.PersistentProcessRunner(app: pynenc.app.Pynenc, runner_cache: Optional[dict] = None, extra_id: Optional[str] = None)[source]¶
Bases:
pynenc.runner.base_runner.BaseRunnerPersistentProcessRunner maintains a fixed number of processes that continuously run tasks.
Initialization
- processes: dict[str, multiprocessing.Process]¶
None
- manager: multiprocessing.Manager¶
None
- stop_event: multiprocessing.synchronize.Event¶
None
- _generate_process_key() str[source]¶
Generates a unique process key using runner_id and an incrementing counter.
- _terminate_all_processes() None[source]¶
Terminates all running processes with graceful shutdown attempt.
- _waiting_for_results(running_invocation: pynenc.invocation.dist_invocation.DistributedInvocation, result_invocations: list[pynenc.invocation.dist_invocation.DistributedInvocation], runner_args: Optional[dict[str, Any]] = None) None[source]¶
In this simplified version, we don’t pause/resume processes. The invocation will just be marked as paused and the process will continue with other invocations.