php - GAE : Push Task Queues - How to push tasks to specific Queues? - 使用 GAE-PHP

标签 php python google-app-engine task-queue

您好,我是 GAE 任务队列的新手,我创建了一个名为 anchorextractor 的队列,该队列显示在队列列表中。 然后我使用 url ('/worker/extractor/1') 创建了一个任务。创建后,如果我回显任务名称,则其显示名称(task3)。我检查队列列表后是任务队列页面,该队列下的任务为0实际上创建了 3 个任务。我尝试了所有的可能性。我认为我解释得很好,这里不需要代码。如果您需要更多解释,我会给出。请任何人帮助我。 (我正在用代码更新问题以供引用,以下是代码):

require_once 'google/appengine/api/taskqueue/PushTask.php';
use google\appengine\api\taskqueue\PushTask;
require_once 'google/appengine/api/taskqueue/PushQueue.php';
use google\appengine\api\taskqueue\PushQueue;

    $queue = new PushQueue('tagextractor');
    $task = new PushTask('/worker/anchorextractor/1', ['content_id' => 'aa', 'content_type' => 'aa']);
    echo "Task Name = ".$task_name = $task->add();
    $queue->addTasks([$task]);

最佳答案

请尝试使用此语法,它会将新任务名称记录到 AppEngine 日志中,作为任务已创建的证据:

require_once 'google/appengine/api/taskqueue/PushTask.php';
use \google\appengine\api\taskqueue\PushTask;

$task_name = (new PushTask('/worker/anchorextractor/1', array(
  'content_id' => 'aa', 
  'content_type' => 'aa'
)))->add("tagextractor");

syslog(LOG_INFO, "new task=".$task_name);

任务的处理速度确实很快,因此有时很难在队列中“看到”它们,但是您可以转到管理控制台中的队列并暂停它,然后任务将不断累积,直到您运行它手动或恢复队列。

关于php - GAE : Push Task Queues - How to push tasks to specific Queues? - 使用 GAE-PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20702407/

相关文章:

php - 在 MySql 数据库中查询当前日期后 30 天内具有 'Birthday' 日期字段的条目

python - 我可以在没有 for 循环的情况下搜索对象列表中的项目吗?

python - Pybind11 特征返回类型问题

google-app-engine - App Engine + 模块 + Maven 的开发工作流程

python - 如何知道上次运行 cron 任务的时间?

python - 如何解决 "[Errno 13] file not accessible"错误?

php - 5 分钟长轮询示例的简单指南不起作用

php - 一对多的最优数据库结构设计

php - 如何在PDO中设置字符集

python - 使用 Scapy 时 ICMP Ping 数据包未生成回复