[英]Error 429 - too much requests - trying to delete all classifiers of IBM Watson Visual Recognition service
I'm trying to delete all classifiers of my instance of IBM Watson Visual Recognition service so that I can create only the new classifiers that are used for my app. 我试图删除我的IBM Watson Visual Recognition服务实例的所有分类器,以便仅创建用于我的应用程序的新分类器。
To do it, I wrote Node.js code that lists all the classifiers and sends a delete request. 为此,我编写了Node.js代码,其中列出了所有分类器并发送了删除请求。
When I executed it (hundreds of delete requests in parallel), I received a 429 error - too many requests
. 当我执行它(并行执行数百个删除请求)时,我收到
429 error - too many requests
。 After that, all of my delete requests (even individual ones) received an 404 error - Cannot delete classifier
. 之后,我所有的删除请求(甚至是单个删除请求)都收到
404 error - Cannot delete classifier
。
My questions are: 我的问题是:
This is the 429 error that I received in the multiple delete requests 这是我在多个删除请求中收到的429错误
code: 429,
error: '<HTML><BODY><span class=\'networkMessage\'><h2>Wow, is it HOT in here!</h2>My CPU cores are practically burning up thanks to all the great questions from wonderful humans like you.<p>Popularity has its costs however. Right now I just can\'t quite keep up with everything. So I ask your patience while my human subsystems analyze this load spike to get me more Power.<p>I particularly want to <b>thank you</b> for bringing your questions. PLEASE COME BACK - soon and frequently! Not only do I learn from your usage, but my humans learn from workload spikes (like this one) how to better adjust capacity with Power and Elastic Storage.<p>So again, thank you for helping to make me smarter and better. I\'m still young and growing, but with your patience and help, I hope to make you proud someday!</p>Your buddy,<br>Watson<br><span class=\'watsonIcon\'></span>p.s. Please share your experiences in the Watson C
Edit: 编辑:
I noticed that the error apparently happens only when I try to delete a "default" classifier that is provided by the service (like "Graphics", "Color", "Black_and_white", etc.). 我注意到该错误显然仅在我尝试删除服务提供的“默认”分类器(例如“图形”,“颜色”,“黑白”等)时发生。 The deletion works fine for when I try do delete a classifier that I created with my own pictures.
当我尝试删除用自己的图片创建的分类器时,删除工作正常。
Is it a characteristic of the service that I'm not allowed to delete the default classifiers ? 不允许删除默认分类器是服务的特征吗? If it is, any special reason for that ?
如果是,那有什么特殊原因吗? The app that I'm building doesn't need all those built-in classifiers, so it is useless to have all that.
我正在构建的应用程序不需要所有这些内置分类器,因此拥有所有这些都是没有用的。
I understand that I can inform the list of classifiers that I want to use when I request a new classification, but in this situation I'll need to keep a separated list of my classifiers and will not be able to request a more generic classification without getting the default classifiers in the result. 我了解我可以在请求新分类时告知要使用的分类器列表,但是在这种情况下,我将需要保留我的分类器的单独列表,并且如果没有此分类,我将无法请求更通用的分类在结果中获取默认分类器。
I'm using node js module "watson-developer-cloud": "^1.3.1" - I'm not sure what API versions it uses internally. 我正在使用节点js模块“ watson-developer-cloud”:“ ^ 1.3.1”-我不确定其内部使用的API版本。 I just noticed there is a newer version available.
我只是注意到有可用的较新版本。 I'll update it and report back here if there is any difference.
如果有任何差异,我将对其进行更新并在此处报告。
This is the JS function that I'm using to delete a single classifier 这是我用来删除单个分类器的JS函数
function deleteClassifier(classifier_id,callback){
var data = {
"classifier_id": classifier_id,
};
visualRecognition.deleteClassifier(data,function(err, response) {
if (err){
callback(err);
}
else{
callback(null, response);
}
});
}
-Edit -编辑
The occurred when I was using V2 API - But I believe it is not related to API version. 当我使用V2 API时发生-但我认为它与API版本无关。 See the accepted answer
查看已接受的答案
1-Is there a better way to delete all classifiers that is not doing it one by one ?
1-是否有一种更好的方法来删除所有未逐个执行的分类器?
No, you must delete them one by one. 不,您必须一个一个地删除它们。
2- Why I'm unable to delete individual classifiers now ?
2-为什么我现在无法删除单个分类器? Is there some policy that blocks me after a 429 too much requests ?
在429个请求过多之后,是否有一些政策阻止我?
I suspect that when your request to DELETE /classifiers/{classifier_id} returns a 404, it is because the classifier_id was previously, successfully deleted. 我怀疑当您对DELETE / classifiers / {classifier_id}的请求返回404时,是因为classifier_id先前已成功删除。 You can verify this by doing a GET /classifiers operation to see the list of all current custom classifiers for your account.
您可以通过执行GET / classifiers操作来查看此信息,以查看您帐户的所有当前自定义分类器的列表。 404 is the designed response to an attempt to delete a classifier which cannot be found (which would be the case if it previously was deleted.) There is no policy which would block you after encountering a 429.
404是对尝试删除找不到的分类器(如果先前已删除的情况,则是这种情况)的设计响应。没有策略会在遇到429后阻止您。
Could you give an example of the URLs you are using - I am curious if it is the beta service (v2) or the newest version, v3? 您能否举一个您正在使用的URL的例子-我很好奇它是beta服务(v2)还是最新版本v3?
I found the problem is that I was trying to delete the default classifiers and that is not allowed. 我发现问题是我试图删除默认分类器,但不允许这样做。
In the later version of the API (V3 as I write this answer) there is only one default classifier and it can not be deleted. 在API的更高版本(我写此答案为V3)中,只有一个默认分类器,不能将其删除。
The 404 errors that I was getting was because I was trying to delete the default classifiers. 我收到的404错误是因为我试图删除默认分类器。 All my custom classifiers were already deleted as Matt Hill mentioned in his answer
正如Matt Hill在他的回答中提到的那样,我所有的自定义分类均已被删除
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.