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

@ -20,6 +20,7 @@ import static google.registry.model.common.Cursor.getCursorTimeOrStartOfTime;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.rde.RdeMode.FULL;
import static google.registry.request.Action.Method.POST;
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.common.flogger.FluentLogger;
@ -82,9 +83,12 @@ public final class RdeReportAction implements Runnable, EscrowTask {
DateTime cursorTime =
getCursorTimeOrStartOfTime(
ofy().load().key(Cursor.createKey(CursorType.RDE_UPLOAD, Registry.get(tld))).now());
if (!cursorTime.isAfter(watermark)) {
logger.atInfo().log("tld=%s reportCursor=%s uploadCursor=%s", tld, watermark, cursorTime);
throw new NoContentException("Waiting for RdeUploadAction to complete");
if (isBeforeOrAt(cursorTime, watermark)) {
throw new NoContentException(
String.format(
"Waiting on RdeUploadAction for TLD %s to send %s report; "
+ "last upload completion was at %s",
tld, watermark, cursorTime));
}
String prefix = RdeNamingUtils.makeRydeFilename(tld, watermark, FULL, 1, 0);
GcsFilename reportFilename = new GcsFilename(bucket, prefix + "-report.xml.ghostryde");