Add reporting cron jobs to production

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173569808
This commit is contained in:
larryruili 2017-10-26 11:54:24 -07:00 committed by jianglai
parent 11a218f9c3
commit 486c348a00
2 changed files with 21 additions and 0 deletions

View file

@ -251,4 +251,23 @@
<target>backend</target> <target>backend</target>
</cron> </cron>
<cron>
<url><![CDATA[/_dr/cron/fanout?queue=retryable-cron-tasks&endpoint=/_dr/task/icannReportingStaging&runInEmpty]]></url>
<description>
Create ICANN activity and transaction reports for last month, storing them in
gs://domain-registry-alpha-reporting/icann/monthly/yyyy-MM
</description>
<schedule>2 of month 09:00</schedule>
<target>backend</target>
</cron>
<cron>
<url><![CDATA[/_dr/cron/fanout?queue=retryable-cron-tasks&endpoint=/_dr/task/icannReportingUpload&runInEmpty]]></url>
<description>
Upload ICANN activity and transaction reports for last month to ICANN, fetching them from
gs://domain-registry-alpha-reporting/icann/monthly/yyyy-MM
</description>
<schedule>4 of month 09:00</schedule>
<target>backend</target>
</cron>
</cronentries> </cronentries>

View file

@ -19,6 +19,7 @@ import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
import static google.registry.reporting.IcannReportingModule.MANIFEST_FILE_NAME; import static google.registry.reporting.IcannReportingModule.MANIFEST_FILE_NAME;
import static google.registry.request.Action.Method.POST; import static google.registry.request.Action.Method.POST;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import static javax.servlet.http.HttpServletResponse.SC_OK;
import com.google.appengine.tools.cloudstorage.GcsFilename; import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
@ -99,6 +100,7 @@ public final class IcannReportingUploadAction implements Runnable {
reportSummaryBuilder.put(reportFilename, success); reportSummaryBuilder.put(reportFilename, success);
} }
emailUploadResults(reportSummaryBuilder.build()); emailUploadResults(reportSummaryBuilder.build());
response.setStatus(SC_OK);
response.setContentType(PLAIN_TEXT_UTF_8); response.setContentType(PLAIN_TEXT_UTF_8);
response.setPayload( response.setPayload(
String.format("OK, attempted uploading %d reports", manifestedFiles.size())); String.format("OK, attempted uploading %d reports", manifestedFiles.size()));