do google app engine pull queues return tasks in F

2020-02-16 04:29发布

Do google app engine pull queues return tasks in FIFO order of their arrival time?

I read the following in the pull queue documentation:

"the API returns the specified number of tasks in order of the oldest task ETA."

ETA = "Estimated time of arrival", which I don't fully understand in this context.

I'm trying get tasks in order of their arrival time in the queue with python.

1条回答
Juvenile、少年°
2楼-- · 2020-02-16 04:44

Each task in the queue has an ETA, by default set to the time when the task in enqueued. But it's possible to enqueue tasks with an ETA in the future (or even in the past). From google.appengine.api.taskqueue package, in between taskqueue.add() arguments:

  • countdown -- Time in seconds into the future that this task should run or be leased. Defaults to zero. Do not specify this argument if you specified an eta.

  • eta -- A datetime.datetime that specifies the absolute earliest time at which the task should run. You cannot specify this argument if the countdown argument is specified. This argument can be time zone-aware or time zone-naive, or set to a time in the past. If the argument is set to None, the default value is now. For pull tasks, no worker can lease the task before the time indicated by the eta argument.

As long as you don't overwrite the default ETA by using these arguments when enqueueing tasks they will be pulled in FIFO order.

查看更多
登录 后发表回答