From 3f13bd9f47a8fe8dc4a294597101006c1ac97cf5 Mon Sep 17 00:00:00 2001 From: Socorro DominguezVidana Date: Tue, 18 Aug 2026 17:11:07 -0700 Subject: [PATCH] NCC-28 changing schedule to run 3 times a week --- .github/workflows/deploy.yml | 4 ++-- .github/workflows/run-minting.yml | 6 +++--- README.md | 14 +++++++------- entrypoint.sh | 2 +- infrastructure/doi-minter.yaml | 24 +++++++++++++++++------- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5071640..64cce97 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,7 +17,7 @@ on: options: [dev, prod] default: dev schedule_enabled: - description: Enable the weekly Friday schedule + description: Enable the recurring schedule (Mon/Wed/Fri) type: choice options: ["DISABLED", "ENABLED"] default: "DISABLED" @@ -182,7 +182,7 @@ jobs: echo "| Stack | \`${STACK_NAME}\` |" echo "| Image | \`${IMAGE_URI}\` |" echo "| Database | \`${RDSDB}\` |" - echo "| Weekly schedule | \`${SCHEDULE_ENABLED}\` |" + echo "| Recurring schedule | \`${SCHEDULE_ENABLED}\` |" echo "" echo "Deploying does not run the minter. Use the **Run DOI Minting**" echo "workflow to trigger a run." diff --git a/.github/workflows/run-minting.yml b/.github/workflows/run-minting.yml index 8752ace..88a3100 100644 --- a/.github/workflows/run-minting.yml +++ b/.github/workflows/run-minting.yml @@ -1,7 +1,7 @@ name: Run DOI Minting -# The manual replacement for the Friday terminal session. The weekly run itself -# is fired by EventBridge Scheduler inside AWS; this workflow is for ad hoc runs +# The manual replacement for the Friday terminal session. The scheduled runs +# are fired by EventBridge Scheduler inside AWS; this workflow is for ad hoc runs # and for verifying the pipeline after a deploy. on: workflow_dispatch: @@ -110,7 +110,7 @@ jobs: run: | set -euo pipefail # `wait tasks-stopped` polls for up to 10 minutes per call; a large - # weekly batch can run longer, so retry until the task really stops. + # batch can run longer, so retry until the task really stops. for _ in $(seq 1 9); do if aws ecs wait tasks-stopped --cluster "$CLUSTER" --tasks "$TASK_ARN" \ --region "$AWS_REGION" 2>/dev/null; then diff --git a/README.md b/README.md index 2b36dc8..c0901e7 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ sequenceDiagram participant NeotomaDB@{ "type" : "database" } participant DataCite@{"type":"boundary"} - Note left of Batch: Trigger to run weekly using Fargate + Note left of Batch: Trigger to run Mon/Wed/Fri using Fargate Batch->>neotomaPyDOI: Trigger a run (cron) neotomaPyDOI->>NeotomaDB: Check for new datasets without DOIs NeotomaDB->>neotomaPyDOI: Return datasetids @@ -85,7 +85,7 @@ uv run ndbdoi.py --tank ## Automated Minting The manual Friday routine — a sandbox pass followed by a production mint — runs -itself on AWS. The `infrastructure/doi-minter.yaml` CloudFormation stack builds +itself on AWS, on Mondays, Wednesdays and Fridays. The `infrastructure/doi-minter.yaml` CloudFormation stack builds out the architecture described in the sequence diagram above. ``` @@ -94,7 +94,7 @@ GitHub Actions (deploy.yml) AWS write credentials ────────────────► Secrets Manager deploy stack ─────────────────────► CloudFormation │ - ├─ EventBridge Scheduler ── cron(0 14 ? * FRI *) + ├─ EventBridge Scheduler ── cron(0 0 ? * MON,WED,FRI *) │ │ │ ▼ ├─ ECS Fargate task (private subnets) @@ -385,10 +385,10 @@ submitted less than two days ago should stay a manual act from a workstation. ### Changing the schedule -`ScheduleExpression` defaults to `cron(0 14 ? * FRI *)` — Fridays at 14:00 UTC, -which is 09:00 US Central in summer and 08:00 in winter. EventBridge Scheduler -supports `ScheduleExpressionTimezone`, so setting it to `America/Chicago` would -hold a constant local time year-round. +`ScheduleExpression` defaults to `cron(0 0 ? * MON,WED,FRI *)`, read in the +`ScheduleTimezone` parameter which defaults to `Los Angeles`; ie midnight Pacific on Mondays, Wednesdays and Fridays. + +Running three times a week shortens how long a new dataset waits for its DOI, keeping the 48 hours window for datasets to settle. ## Neotoma DOI Metadata diff --git a/entrypoint.sh b/entrypoint.sh index 91d5544..47949ed 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# The weekly Neotoma DOI minting run, as previously performed by hand: +# The Neotoma DOI minting run, as previously performed by hand each Friday: # # uv run ndbdoi.py # DataCite sandbox pass, used here as a gate # uv run ndbdoi.py -m # the real mint against api.datacite.org diff --git a/infrastructure/doi-minter.yaml b/infrastructure/doi-minter.yaml index cff594e..cf22cfb 100644 --- a/infrastructure/doi-minter.yaml +++ b/infrastructure/doi-minter.yaml @@ -2,7 +2,7 @@ AWSTemplateFormatVersion: "2010-09-09" Description: > Scheduled Neotoma DOI minting. Runs neotomapydoi as an ECS Fargate task inside the VPC (so it can reach the Neotoma RDS instance on its private subnets), - triggered weekly by EventBridge Scheduler. Logs go to CloudWatch and S3; + triggered on a schedule by EventBridge Scheduler. Logs go to CloudWatch and S3; a non-zero task exit publishes to an SNS topic that emails a human. Parameters: @@ -47,10 +47,20 @@ Parameters: ScheduleExpression: Type: String - Default: cron(0 14 ? * FRI *) + Default: cron(0 0 ? * MON,WED,FRI *) Description: > - When to run, in UTC. The default is Fridays at 14:00 UTC, which is 09:00 - US Central during daylight saving and 08:00 outside it. + When to run, interpreted in ScheduleTimezone. The default is midnight on + Mondays, Wednesdays and Fridays. Note the selection query only picks up + datasets more than two days old, so running more often shortens the wait + before a new dataset is minted rather than minting anything sooner. + + ScheduleTimezone: + Type: String + Default: America/Los_Angeles + Description: > + IANA timezone the schedule is read in. Using a named zone rather than UTC + keeps the local run time fixed across daylight saving changes, instead of + drifting by an hour twice a year. ScheduleEnabled: Type: String @@ -58,7 +68,7 @@ Parameters: AllowedValues: ["ENABLED", "DISABLED"] Description: > Leave DISABLED until a manual run has been verified end to end, then - redeploy with ENABLED to hand the Friday job over to the scheduler. + redeploy with ENABLED to hand the recurring job over to the scheduler. Resources: @@ -245,10 +255,10 @@ Resources: Type: AWS::Scheduler::Schedule Properties: Name: !Sub "neotoma-doi-minting-${Environment}" - Description: Weekly Neotoma DOI minting run. + Description: Neotoma DOI minting run (midnight, Mondays/Wednesdays/Fridays). State: !Ref ScheduleEnabled ScheduleExpression: !Ref ScheduleExpression - ScheduleExpressionTimezone: UTC + ScheduleExpressionTimezone: !Ref ScheduleTimezone FlexibleTimeWindow: Mode: "OFF" Target: