Skip to content

Commit

Permalink
theoretically start new queue job for an annot child subtask if it fails
Browse files Browse the repository at this point in the history
  • Loading branch information
naknomum committed Jan 3, 2024
1 parent feef16d commit 6420270
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/main/java/org/ecocean/servlet/IAGateway.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,33 @@ public static JSONObject _doIdentify(JSONObject jin, JSONObject res, Shepherd my
for (int i = 0 ; i < anns.size() ; i++) {
Annotation ann = anns.get(i);
JSONObject queryConfigDict = IBEISIA.queryConfigDict(myShepherd, opt);
JSONObject taskRes = _sendIdentificationTask(ann, context, baseUrl, queryConfigDict, null, limitTargetSize, subTasks.get(i),myShepherd,fastlane);
JSONObject taskRes = new JSONObject();
Task subTask = subTasks.get(i);
try {
taskRes = _sendIdentificationTask(ann, context, baseUrl, queryConfigDict, null, limitTargetSize, subTask, myShepherd,fastlane);
} catch (Exception ex) {
System.out.println("subTask failure on " + subTask + ": " + ex.toString());
taskRes.put("success", false);
taskRes.put("error", ex.toString());
System.out.println(">>>>>>> parentTask: " + parentTask);
System.out.println(">>>>>>> parentTask params: " + parentTask.getParameters());
System.out.println(">>>>>>> jin: " + jin);
JSONObject jobj = new JSONObject();
jobj.put("identify", new JSONObject());
jobj.getJSONObject("identify").put("annotationIds", new JSONArray());
jobj.getJSONObject("identify").getJSONArray("annotationIds").put(ann.getId());
jobj.put("taskId", subTask.getId());
jobj.put("__baseUrl", baseUrl);
jobj.put("__context", context);
jobj.put("__queueActualRetries", jin.optInt("__queueActualRetries", 0));
jobj.put("__queueRetries", jin.optInt("__queueRetries", 0));
jobj.put("__queueStart", jin.optLong("__queueStart", System.currentTimeMillis()));
requeueJob(jobj, true);
}
taskRes.put("subTaskId", subTask.getId());
taskRes.put("subTaskIndex", i);
taskList.put(taskRes);
System.out.println("subTask[" + i + "] => " + taskRes.toString());
}
if (limitTargetSize > -1) res.put("_limitTargetSize", limitTargetSize);
res.put("tasks", taskList);
Expand Down

0 comments on commit 6420270

Please sign in to comment.