Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset clips updates and update cron schedule for UpdateDB job #102

Merged
merged 6 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ api:
- offsets_db_api/**/*
- migrations/**/*
- Procfile
- environment.yml
- requirements.txt
- release.sh
- fly.*.toml

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:

schedule:
- cron: '45 1 * * *' # 1:45am UTC every day
- cron: '45 6 * * *' # 6:45am UTC every day

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fastapi==0.109.1
fastparquet
gunicorn
httpx
offsets-db-data>=2024.1.1
offsets-db-data>=2024.2.3
pandas>=1.5.3
pandera>=0.17
psycopg2-binary==2.9.9
Expand Down
14 changes: 7 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ def setup_post(test_app):
# Define payload for POST request
payload = [
{
'url': 's3://carbonplan-share/offsets-db-testing-data/final/credits-augmented.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/credits-augmented.parquet',
'category': 'credits',
},
{
'url': 's3://carbonplan-share/offsets-db-testing-data/final/projects-augmented.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/projects-augmented.parquet',
'category': 'projects',
},
{
'url': 's3://carbonplan-offsets-db/final/2024-01-01/curated-clips.parquet',
'category': 'clips',
},
{
'url': 's3://carbonplan-offsets-db/final/2024-01-01/weekly-summary-clips.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/curated-clips.parquet',
'category': 'clips',
},
# {
# 'url': 's3://carbonplan-offsets-db/final/2024-02-13/weekly-summary-clips.parquet',
# 'category': 'clips',
# },
]

headers = {
Expand Down
14 changes: 7 additions & 7 deletions tests/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ def test_submit_bad_file(test_app):
def test_submit_file(test_app):
urls = [
{
'url': 's3://carbonplan-share/offsets-db-testing-data/final/credits-augmented.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/credits-augmented.parquet',
'category': 'credits',
},
{
'url': 's3://carbonplan-share/offsets-db-testing-data/final/projects-augmented.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/projects-augmented.parquet',
'category': 'projects',
},
{
'url': 's3://carbonplan-offsets-db/final/2024-01-01/curated-clips.parquet',
'category': 'clips',
},
{
'url': 's3://carbonplan-offsets-db/final/2024-01-01/weekly-summary-clips.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/curated-clips.parquet',
'category': 'clips',
},
# {
# 'url': 's3://carbonplan-offsets-db/final/2024-02-13/weekly-summary-clips.parquet',
# 'category': 'clips',
# },
]

headers = {
Expand Down
8 changes: 4 additions & 4 deletions update_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def get_latest(*, bucket: str):

data.append({'category': key, 'url': entry_url})

weekly_summary_start = datetime.date(year=2024, month=1, day=1)
weekly_summary_start = datetime.date(year=2024, month=2, day=6)
weekly_summary_end = datetime.datetime.utcnow().date()
date_ranges = pd.date_range(
start=weekly_summary_start, end=weekly_summary_end, freq='W-MON', inclusive='both'
start=weekly_summary_start, end=weekly_summary_end, freq='W-TUE', inclusive='both'
)

added_weeks = set()
Expand Down Expand Up @@ -82,11 +82,11 @@ def post_data_to_environment(*, env: str, bucket: str) -> None:
'category': 'projects',
},
{
'url': 's3://carbonplan-offsets-db/final/2024-01-01/curated-clips.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-08/curated-clips.parquet',
'category': 'clips',
},
{
'url': 's3://carbonplan-offsets-db/final/2024-01-01/weekly-summary-clips.parquet',
'url': 's3://carbonplan-offsets-db/final/2024-02-13/weekly-summary-clips.parquet',
'category': 'clips',
},
]
Expand Down
Loading