2024-08-19 09:43:46 +08:00
|
|
|
|
---
|
|
|
|
|
title: liteyuki.core.manager
|
|
|
|
|
order: 1
|
|
|
|
|
icon: laptop-code
|
|
|
|
|
category: API
|
|
|
|
|
---
|
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
### ***class*** `ChannelDeliver`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
### ***class*** `ProcessManager`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
进程管理器
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
###   ***def*** `start(self: Any, name: str) -> None`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 开启后自动监控进程,并添加到进程字典中
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
|
|
|
|
Args:
|
2024-08-19 09:55:47 +08:00
|
|
|
|
|
2024-08-19 09:43:46 +08:00
|
|
|
|
name:
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
###   ***def*** `start_all(self: Any) -> None`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 启动所有进程
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
###   ***def*** `add_target(self: Any, name: str, target: TARGET_FUNC, args: tuple, kwargs: Any) -> None`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 添加进程
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
name: 进程名,用于获取和唯一标识
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
target: 进程函数
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
args: 进程函数参数
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
kwargs: 进程函数关键字参数,通常会默认传入chan_active和chan_passive
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
###   ***def*** `join_all(self: Any) -> None`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 
|
|
|
|
|
|
|
|
|
|
###   ***def*** `terminate(self: Any, name: str) -> None`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 终止进程并从进程字典中删除
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
|
|
|
|
Args:
|
2024-08-19 09:55:47 +08:00
|
|
|
|
|
2024-08-19 09:43:46 +08:00
|
|
|
|
name:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
Returns:
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
###   ***def*** `terminate_all(self: Any) -> None`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
###   ***def*** `is_process_alive(self: Any, name: str) -> bool`
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
 检查进程是否存活
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
|
2024-08-19 09:55:47 +08:00
|
|
|
|
name:
|
2024-08-19 09:43:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|