【发布时间】:2019-09-26 22:21:09
【问题描述】:
我用 Python 编写了一个小型后端应用程序(在 Google App Engine 上运行),作为我在不同应用程序中使用的几个 Google Cloud Functions 的自定义远程调度程序。通常,函数会要求后端使用给定的有效负载安排回调。一切都很好,除了在后端应用程序上,负责回调我的 Cloud Functions 的线程通常会在几个小时后死掉:https://imgur.com/a/8ulENjf
不用说我不是joining线程。
我已经阅读了 UNIX 服务器使用 Python 发出的 Python SIGINT 信号,但我需要先排除更简单的选项。相关部分代码如下:
import time
from datetime import datetime, timedelta
import sched
from threading import Thread
scheduler = sched.scheduler(time.time, time.sleep)
scheduler.enterabs(schedTime, 1, callback, kwargs=payload)
t.thread = Thread(target=scheduler.run) #dispatching scheduler main function to thread
t.start()
【问题讨论】:
标签: python-3.x google-app-engine google-cloud-platform job-scheduling