Don't retry RDE upload tasks that have failed dependencies

New upload tasks are created every 4 hours, so if we're waiting on a 2 hour SFTP cooldown or some other long-running dependency like generating the RDE report, just delete this task and let it re-run at the next 4 hour period.  No need to let these tasks continue gumming up the queue.

Note that this method of throwing NoContentException to abort the task without enqueuing it for retry is already being used by RdeReportAction for the same purpose.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201372808
This commit is contained in:
mcilwain 2018-06-20 10:18:29 -07:00 committed by Ben McIlwain
parent a5cc359813
commit c8925555d4
5 changed files with 98 additions and 57 deletions

View file

@ -94,15 +94,11 @@ class EscrowTaskRunner {
if (nextRequiredRun.isAfter(startOfToday)) {
throw new NoContentException("Already completed");
}
logger.atInfo().log("Cursor: %s", nextRequiredRun);
logger.atInfo().log("Current cursor is: %s", nextRequiredRun);
task.runWithLock(nextRequiredRun);
ofy()
.transact(
() ->
ofy()
.save()
.entity(
Cursor.create(cursorType, nextRequiredRun.plus(interval), registry)));
DateTime nextRun = nextRequiredRun.plus(interval);
logger.atInfo().log("Rolling cursor forward to %s.", nextRun);
ofy().transact(() -> ofy().save().entity(Cursor.create(cursorType, nextRun, registry)));
return null;
};
String lockName = String.format("EscrowTaskRunner %s", task.getClass().getSimpleName());