feat(standalone): 新增单机模式,KILOSTAR_MODE=standalone 时去掉 Ray 依赖
通过 StandaloneProxy 适配层让 .remote() 调用在单机模式下透明降级为 asyncio 协程调用,7 个 Actor 和 workflow task 均可在纯 asyncio 环境运行, 启动快、资源占用低。分布式模式行为完全不变。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -12,12 +12,18 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import ray
|
||||
import os
|
||||
import time
|
||||
import asyncio
|
||||
from collections import OrderedDict
|
||||
from ray.util.queue import Queue
|
||||
from kilostar.utils.standalone_proxy import actor_class
|
||||
from kilostar.utils.ray_hook import ray_actor_hook
|
||||
|
||||
_STANDALONE = os.environ.get("KILOSTAR_MODE", "distributed") == "standalone"
|
||||
if _STANDALONE:
|
||||
from asyncio import Queue
|
||||
else:
|
||||
from ray.util.queue import Queue
|
||||
from kilostar.worker_individual.base_individual import BaseIndividual
|
||||
from kilostar.worker_individual.skill_individual import SkillIndividual
|
||||
from kilostar.worker_individual.ordinary_individual import OrdinaryIndividual
|
||||
@@ -27,7 +33,7 @@ from kilostar.worker_individual.special_individual import SpecialIndividual
|
||||
from kilostar.utils.logger import get_logger
|
||||
|
||||
|
||||
@ray.remote
|
||||
@actor_class
|
||||
class WorkerCluster:
|
||||
"""
|
||||
工作集群 Actor:管理和调度所有的 worker_individual
|
||||
|
||||
Reference in New Issue
Block a user