如何避免APS调度程序添加作业?

2024-10-03 15:21:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我在我的进程中添加了一个apscheduler作业,我发现我的子进程也有这个作业,, 我的主要流程和下属同时执行任务。。。在

主程序是

server = StreamServer((server_ip, server_port), serve_forever, spawn = pool, backlog=100000)

for i in range(process_count - 1):
    Process(target=serve_forever, args=()).start()

我的apscheduler是

^{pr2}$

输出是

Tick! The time is: 1409042763.26 pocess is 11428
Tick! The time is: 1409042763.26 pocess is 11431
Tick! The time is: 1409042763.26 pocess is 11424
Tick! The time is: 1409042763.26 pocess is 11430
Tick! The time is: 1409042763.26 pocess is 11426
Tick! The time is: 1409042763.26 pocess is 11380
Tick! The time is: 1409042763.26 pocess is 11425
Tick! The time is: 1409042763.26 pocess is 11429
Tick! The time is: 1409042763.26 pocess is 11432
Tick! The time is: 1409042763.26 pocess is 11433

Tags: theipservertime进程is作业流程
1条回答
网友
1楼 · 发布于 2024-10-03 15:21:13

一些想法:

  1. 只有在创建了子流程之后才启动调度程序
  2. 关闭子进程中的调度程序
  3. 通过其他方式创建子流程,而不是分叉主流程

相关问题 更多 >