Google App Engine 中任务队列的时间限制

发布于 2024-10-22 04:41:46 字数 154 浏览 1 评论 0原文

我正在 GAE 中使用任务队列为我的应用程序执行一些后台工作。我了解到某项特定任务有 10 分钟的时间限制。我关心的是如何在本地环境中测试这个东西。我尝试了线程睡眠,但它没有抛出谷歌应用程序引擎文档中提到的任何异常。也就是这个时间限制是以CPU时间或者实际时间来衡量的。

谢谢。

I am using Task Queue in GAE for performing some background work for my application. I have come to know that there is a 10 minute time limit for a particular task. My concern is how do I test this thing in my local environment. I tried thread sleep but it didn't throw any exception as mentioned in google app engine docs. Also is this time limit is measured by CPU time or the actual time.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

幸福不弃 2024-10-29 04:41:46

时间以挂钟时间测量。开发服务器不强制执行时间限制,尽管不清楚您为什么要测试它,因为您的测试不太可能与生产中的性能相同,因此尝试猜测您将能够完成多少工作在生产服务器上花 10 分钟看看在开发服务器上 10 分钟能完成多少工作将会严重失败。

The time is measured in wall clock time. The development server doesn't enforce time limits, although it's unclear why you'd want to test it because it's unlikely your tests will perform the same as they will in production, so trying to guess how much you'll be able to accomplish in 10 minutes on the production servers by seeing how much you can accomplish in 10 minutes on the development server will fail horribly.

远山浅 2024-10-29 04:41:46

对于您的开发服务器,在启动任务时启动计时器。如果挂钟时间达到 10 分钟,请继续检查您的代码。当你到达时,抛出一个 DeadlineExceededError 。最好在调用代码的特定函数的类处理程序中包含 try 和 except 语句。

For your development server, start a timer when a task is initiated. keep checking in your code if you reached 10 mins wall clock time. When you reach, throw a DeadlineExceededError. It would be better to have the try and except statements in the class handlers which call a particular function of your code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文