Flask Cron作业在Google云上失败
我正在尝试使用在Google云上部署的服务器中添加计划任务。在部署之前,我正在localhost中进行测试,因此我配置了一个简单的cron.yaml文件,如下所示:Flask Cron作业在Google云上失败,flask,cron,google-cloud-platform,yaml,scheduled-tasks,Flask,Cron,Google Cloud Platform,Yaml,Scheduled Tasks,我正在尝试使用在Google云上部署的服务器中添加计划任务。在部署之前,我正在localhost中进行测试,因此我配置了一个简单的cron.yaml文件,如下所示: #cron file cron: - description: Testing cron functionality url: /task schedule: every 1 minutes 一个简单的端点,如下所示: #myblueprint.py #from ... import .... from app.exce
#cron file
cron:
- description: Testing cron functionality
url: /task
schedule: every 1 minutes
一个简单的端点,如下所示:
#myblueprint.py
#from ... import ....
from app.exceptions.sql_exceptions import (NotFoundException, InvalidValueException)
from fga.frameworks.flask.core import BeforeRequestFlow
tasks_bp = flask.Blueprint('task', __name__, url_prefix='/task')
@tasks_bp.route('', methods=['GET'])
def new_or_list():
logging.info("++++++++++++++++++TEST CRON++++++++++++++++++")
return flask.Response(
response="Cron ejecutado correctamente",
status=201
)
因此,我在localhost上运行我的服务器,并进入了模拟gCloud环境的developmentsdk页面。在Cron Jobs部分,会显示我的任务以及执行该任务的倒计时,但当计数变为0时,则不会执行该任务
只有当我按下“立即运行”按钮时,它才会执行,并在控制台中显示所需的调试消息。为什么?
手动执行cron任务,因为我单击了立即运行按钮开发服务器不运行cron作业。这是一个长期缺少的功能。感谢您提供的信息,您知道这个“错误”的来源吗?