如何在Appengine上停止延迟任务?

huangapple go评论148阅读模式
英文:

How Do I Stop a Delayed Task on Appengine?

问题

我使用了delayed包启动了一个任务。

唯一的问题是任务失败了(哎呀!)并且一直在不断尝试。我知道RetryCount字段,但我想自己强制终止任务。

有人知道如何做到吗?

英文:

I launched a task using the delayed package

The only problem is that the task is failing (ooops!) and is keeping trying it again and again. I am aware of the RetryCount field but I would like to force kill the task myself.

Does anyone knows a way to do it ?

答案1

得分: 1

以下是从App Engine文档中提取的示例,这些示例表明通过delay.Function#Call创建的所有延迟任务都应该进入default队列,因此可以通过管理界面进行删除。如果不是这样,我会认为这是一个错误。

事实上,我们的延迟任务进入了default队列,并且我们可以通过管理界面删除它们。

https://developers.google.com/appengine/docs/go/taskqueue/delay#Function.Call

> func (f *Function) Call(c appengine.Context, args ...interface{})

Call调用一个延迟函数。

> f.Call(c, ...)

等同于

> t, _ := f.Task(...)
> taskqueue.Add(c, t, "")

https://developers.google.com/appengine/docs/go/taskqueue/reference#Add

> func Add(c appengine.Context, task *Task, queueName string) (*Task, error)

Add将任务添加到指定的队列。空的队列名称意味着将使用默认队列。Add返回一个等效的Task,其中包含填充的默认值,包括如果原始名称为空,则将任务的Name字段设置为所选名称。

英文:

The below samples from the App Engine docs would indicate that all your delay tasks created via delay.Function#Call should go to the default queue, and thus be deletable via the admin interface. If not, I would call it bug.

In fact, our delay tasks went to the default queue, and we could delete them with the admin interface.

https://developers.google.com/appengine/docs/go/taskqueue/delay#Function.Call

> func (f *Function) Call(c appengine.Context, args ...interface{})

Call invokes a delayed function.

> f.Call(c, ...)

is equivalent to

> t, _ := f.Task(...)
> taskqueue.Add(c, t, "")

https://developers.google.com/appengine/docs/go/taskqueue/reference#Add

> func Add(c appengine.Context, task *Task, queueName string) (*Task, error)

Add adds the task to a named queue. An empty queue name means that the default queue will be used. Add returns an equivalent Task with defaults filled in, including setting the task's Name field to the chosen name if the original was empty.

huangapple
  • 本文由 发表于 2013年12月5日 00:05:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/20380157.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定