Pergunta

Hi i am new to GAE task queues, I created one queue with name anchorextractor, this is showing in queues list. Then i created a task with the url ('/worker/extractor/1'). after creating if i echo the name of task, its showing name ( task3 ). After i checked the queues list is Taskqueue page, Tasks under this queue is 0. Actually there are 3 tasks created. I tried with all possibilities. I think i explained well and no need of code here. If u need more explination i will give. Please anyone help me. (I am updating the question with code for reference, following is the code):

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]);
Foi útil?

Solução

Try this syntax instead, it will log the new tasks name to the AppEngine logs as proof that the task was created:

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);

Tasks do get processed very quickly, so it is sometimes difficult to "see" them in the queue, you can however go to the queue in the admin console and pause it, the tasks will then build up until you either run it manually or resume the queue.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top