Google App Engine (Java) TaskQueue API:如何查询正在运行/待处理的任务数量?
是否可以以编程方式查询任务队列 API 以查看当前正在执行/待处理的任务数量?
我在 API 中看不到任何方法可以做到这一点,因此我求助于在数据存储中创建对象来表示排队任务。运行时,任务会从数据存储中删除其相应的条目。
正如您可以想象的那样,这很容易不同步。实际上,我很高兴能够获得给定队列名称的队列中任务的简单计数。
Is it possible to programmatically query the Task Queue API to see how many tasks are currently executing/pending?
I don't see any way to do this in the API, and so I resorted to creating objects in the Datastore to represent queued tasks. When run, the tasks then remove their corresponding entry from the Datastore.
As you can imagine, it's easy for this to get out of sync. I'd actually be pretty happy just to be able to get a simple count of tasks in the queue for a given queue name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不幸的是,没有可用于获取有关任务队列的信息的 API。然而,我相信这是团队对未来的考虑(一个编程接口,用于获取我们当前在仪表板上看到的统计数据,例如任务计数)。
Unfortunately, there is no API you can use to get information about the task queues. However, this is something I believe the team has in mind for the future (a programmatic interface to get stats that we currently see on the dashboard, like task count).
正如四月份宣布的那样,任务队列统计信息目前可供可信测试人员使用。任务队列统计信息允许您从应用程序内获取有关任务队列的统计信息和信息。
http://googleappengine.blogspot.com.au/2012_04_01_archive.html
As announced in April, Task Queue Statistics are currently available to Trusted Testers. Task Queue Statistics allows you to fetch statistics and information about your task queue from within your application.
http://googleappengine.blogspot.com.au/2012_04_01_archive.html
QueueStatistics 类可以为您提供有关统计信息的信息,例如队列中的任务数量和当前执行的任务。
A QueueStatistics class can provide you information about stats such as number of tasks in a queue and tasks that are currently executed.
在java中:
In java: