Skip to content

Commit

Permalink
replace public scorer record (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
larisa17 authored Dec 17, 2024
1 parent ea0a02b commit 125487c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
13 changes: 8 additions & 5 deletions infra/aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ const coreVpcId = coreInfraStack.getOutput("vpcId");
const corePrivateSubnetIds = coreInfraStack.getOutput("privateSubnetIds");
const rdsSecretArn = coreInfraStack.getOutput("rdsSecretArn");

const albDnsName = coreInfraStack.getOutput("coreAlbDns");
const CERAMIC_CACHE_SCORER_ID_CONFG = Object({
review: 1,
staging: 14,
Expand Down Expand Up @@ -1484,7 +1485,9 @@ export const dailyScoreExportForOSO = createScheduledTask({
const exportVals = createScoreExportBucketAndDomain(
publicDataDomain,
publicDataDomain,
route53ZoneForPublicData
route53ZoneForPublicData,
stack,
albDnsName
);
// The following scorer dumps the Allo scorer scores to a public S3 bucket
// for the Allo team to easily pull the data
Expand All @@ -1504,7 +1507,7 @@ const frequentAlloScorerDataDumpTaskDefinition = pulumi
"scorer_dump_data",
"--batch-size=1000",
"--database=read_replica_analytics",
`--cloudfront_distribution_id=${cloudFrontId}`,
// `--cloudfront_distribution_id=${cloudFrontId}`,
"--config",
"'" +
JSON.stringify([
Expand Down Expand Up @@ -1611,7 +1614,7 @@ const frequentScorerDataDumpTaskDefinitionForScorer_335 = pulumi
"scorer_dump_data",
"--batch-size=1000",
"--database=read_replica_analytics",
`--cloudfront_distribution_id=${cloudFrontId}`,
// `--cloudfront_distribution_id=${cloudFrontId}`,
"--config",
"'" +
JSON.stringify([
Expand Down Expand Up @@ -1651,7 +1654,7 @@ const frequentScorerDataDumpTaskDefinitionForScorer_6608 = pulumi
"scorer_dump_data",
"--batch-size=1000",
"--database=read_replica_analytics",
`--cloudfront_distribution_id=${cloudFrontId}`,
// `--cloudfront_distribution_id=${cloudFrontId}`,
"--config",
"'" +
JSON.stringify([
Expand Down Expand Up @@ -1694,7 +1697,7 @@ const frequentEthModelV2ScoreDataDumpTaskDefinitionForScorer = pulumi
"manage.py",
"scorer_dump_data_model_score",
`--s3-uri=s3://${publicDataDomain}/model_scores/`,
`--cloudfront_distribution_id=${cloudFrontId}`,
// `--cloudfront_distribution_id=${cloudFrontId}`,
"--filename=model_scores.parquet",
"--format=parquet",
].join(" "),
Expand Down
40 changes: 27 additions & 13 deletions infra/lib/scorer/new_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ export function createScorerECSService({
export async function createScoreExportBucketAndDomain(
bucketName: string,
domain: string,
route53Zone: string
route53Zone: string,
stack: string,
albDnsName: Output<any>
) {
const scoreBucket = new aws.s3.Bucket(domain, {
bucket: bucketName,
Expand Down Expand Up @@ -595,19 +597,31 @@ export async function createScoreExportBucketAndDomain(
{}
);

new aws.route53.Record(domain, {
name: domain,
zoneId: route53Zone,
type: "A",
aliases: [
{
name: cloudFront.domainName,
zoneId: cloudFront.hostedZoneId,
evaluateTargetHealth: false,
},
],
// new aws.route53.Record(domain, {
// name: domain,
// zoneId: route53Zone,
// type: "A",
// aliases: [
// {
// name: cloudFront.domainName,
// zoneId: cloudFront.hostedZoneId,
// evaluateTargetHealth: false,
// },
// ],
// });

// This will return a static response
pulumi.all([albDnsName]).apply(([_albDnsName]) => {
if (stack === "production") {
new aws.route53.Record(domain, {
name: domain,
zoneId: route53Zone,
type: "CNAME",
ttl: 300,
records: [_albDnsName],
});
}
});

return {
exportCertificate,
publicExportCertificateValidationDomain,
Expand Down

0 comments on commit 125487c

Please sign in to comment.