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.
To do it, I wrote Node.js code that lists all the classifiers and sends a delete request.
When I executed it (hundreds of delete requests in parallel), I received a 429 error - too many requests
. After that, all of my delete requests (even individual ones) received an 404 error - Cannot delete classifier
.
My questions are:
- Is there a better way to delete all classifiers that is not doing it one by one?
- Why am I unable to delete individual classifiers now? Is there some policy that blocks me after a 429 too many requests error?
This is the 429 error that I received in the multiple delete requests
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. 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
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. See the accepted answer