Skip to content

Commit

Permalink
Update workflows (#3858)
Browse files Browse the repository at this point in the history
* Update workflows

* Apply ruff-format updates

---------

Co-authored-by: Krystle Salazar <[email protected]>
  • Loading branch information
openverse-bot and krysal authored Mar 1, 2024
1 parent d8ac2d2 commit 331b576
Show file tree
Hide file tree
Showing 63 changed files with 83 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pr_label_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- get_label_groups
steps:
- name: Check aspect label
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
uses: docker://agilepathway/pull-request-label-checker:v1.6.23
with:
any_of: ${{ needs.get_label_groups.outputs.aspect }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -55,7 +55,7 @@ jobs:
- get_label_groups
steps:
- name: Check goal label
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
uses: docker://agilepathway/pull-request-label-checker:v1.6.23
with:
one_of: ${{ needs.get_label_groups.outputs.goal }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -68,7 +68,7 @@ jobs:
- get_label_groups
steps:
- name: Check priority label
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
uses: docker://agilepathway/pull-request-label-checker:v1.6.23
with:
one_of: ${{ needs.get_label_groups.outputs.priority }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -81,7 +81,7 @@ jobs:
- get_label_groups
steps:
- name: Check stack label
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
uses: docker://agilepathway/pull-request-label-checker:v1.6.23
with:
any_of: ${{ needs.get_label_groups.outputs.stack }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ repos:
- id: requirements-txt-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.3.0
hooks:
- id: ruff # replaces Flake8, isort, pydocstyle, pyupgrade
args:
Expand Down Expand Up @@ -74,7 +74,7 @@ repos:
- id: shfmt-docker

- repo: https://github.com/rhysd/actionlint
rev: v1.6.26
rev: v1.6.27
hooks:
- id: actionlint-docker

Expand Down Expand Up @@ -153,7 +153,7 @@ repos:
files: (.vale/.*|.mdx?)$

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.168.1
rev: 37.221.1
hooks:
- id: renovate-config-validator
args:
Expand Down
1 change: 1 addition & 0 deletions api/api/constants/media_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Also see `ingestion_server/constants/media_types.py`."""

from typing import Literal


Expand Down
6 changes: 3 additions & 3 deletions api/api/utils/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
asyncio.AbstractEventLoop, aiohttp.ClientSession
] = weakref.WeakKeyDictionary()

_LOCKS: weakref.WeakKeyDictionary[
asyncio.AbstractEventLoop, asyncio.Lock
] = weakref.WeakKeyDictionary()
_LOCKS: weakref.WeakKeyDictionary[asyncio.AbstractEventLoop, asyncio.Lock] = (
weakref.WeakKeyDictionary()
)


@asgi_shutdown.connect
Expand Down
1 change: 0 additions & 1 deletion api/api/utils/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
frontend, or open an issue to track it.
"""


from api.constants.licenses import (
ALL_CC_LICENSES,
DEPRECATED_CC_LICENSES,
Expand Down
1 change: 1 addition & 0 deletions api/conf/urls/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/http/urls/
"""

from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
Expand Down
3 changes: 1 addition & 2 deletions api/test/fixtures/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def ensure_asgi_lifecycle(session_loop: asyncio.AbstractEventLoop):
"""
scope = {"type": "lifespan"}

async def noop(*args, **kwargs):
...
async def noop(*args, **kwargs): ...

async def shutdown():
return {"type": "lifespan.shutdown"}
Expand Down
6 changes: 3 additions & 3 deletions api/test/unit/utils/test_throttle.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def enable_throttles(settings):
# Put settings into base Django settings from which DRF reads
# settings when we call `api_settings.reload()`
settings.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = settings.DEFAULT_THROTTLE_RATES
settings.REST_FRAMEWORK[
"DEFAULT_THROTTLE_CLASSES"
] = settings.DEFAULT_THROTTLE_CLASSES
settings.REST_FRAMEWORK["DEFAULT_THROTTLE_CLASSES"] = (
settings.DEFAULT_THROTTLE_CLASSES
)

# Reload the settings and read them from base Django settings
# Also handles importing classes from class strings, etc
Expand Down
1 change: 0 additions & 1 deletion automations/python/models/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Label:

"""
Represents a single label.
Expand Down
1 change: 1 addition & 0 deletions automations/python/workflows/get_folder_differences.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
files on the docs preview site. Finally, it outputs the preview site docs
generated comment along with a list of new and changed files.
"""

import os
import shutil
import subprocess
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/common/cloudwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
in the Airflow Variables, which is particularly the desired behavior when running
the Data Refresh DAGs locally or in a development environment.
"""

import logging

from airflow.exceptions import AirflowSkipException
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/common/licenses/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module has a number of public methods which are useful for working
with licenses.
"""

import logging
from functools import lru_cache
from typing import NamedTuple
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/common/loader/provider_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
might be useful for retrieving sub-providers at the database level and the
API level.
"""

import os


Expand Down
1 change: 1 addition & 0 deletions catalog/dags/common/storage/db_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module contains the lists of database columns in the same order as in the
main media tables within the database.
"""

from common.constants import AUDIO, IMAGE
from common.storage import columns as col
from common.utils import setup_kwargs_for_media_type
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/common/storage/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module has public methods which are useful for storage operations."""

import logging

from common.storage.audio import AudioStore
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/common/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This module has a number of public methods which are useful for
verifying and cleaning URLs.
"""

import logging
import re
from functools import lru_cache
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/data_refresh/create_filtered_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
finally deleting the old, now unused filtered index. These TaskGroups are used in
the data refresh DAGs to execute the filtered index steps.
"""

from datetime import timedelta

from airflow.operators.empty import EmptyOperator
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/data_refresh/create_filtered_index_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
This ensures that neither are depending on or modifying the origin indexes
critical for the creation of the filtered indexes.
"""

from datetime import datetime

from airflow import DAG
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/data_refresh/dag_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [[Feature] Merge popularity calculations and data refresh into a single DAG](
https://github.com/WordPress/openverse-catalog/issues/453)
"""

import logging
from collections.abc import Sequence

Expand Down
1 change: 1 addition & 0 deletions catalog/dags/data_refresh/data_refresh_task_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
- [[Feature] Data refresh orchestration DAG](
https://github.com/WordPress/openverse-catalog/issues/353)
"""

import logging
import os
from collections.abc import Sequence
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/data_refresh/data_refresh_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
for each of our media types. This configuration information is used to generate
the dynamic Data Refresh dags.
"""

import os
from dataclasses import dataclass, field
from datetime import datetime, timedelta
Expand Down
1 change: 0 additions & 1 deletion catalog/dags/database/batched_update/batched_update_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
failures during the `update_batches` step.
"""


import logging

from airflow.decorators import dag
Expand Down
1 change: 0 additions & 1 deletion catalog/dags/database/delete_records/delete_records_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
DAGs are not currently running.
"""


import logging

from airflow.decorators import dag
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/database/report_pending_reported_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
taken. If a record has been reported multiple times, it only needs to be
reviewed once and so is only counted once in the reporting by this DAG.
"""

import logging
import os
from textwrap import dedent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
}
```
"""

import logging

from airflow import DAG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* `recreate_full_staging_index`
* `create_new_staging_es_index`
"""

from datetime import datetime, timedelta

from airflow.decorators import dag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* `create_proportional_by_provider_staging_index`
* `create_new_staging_es_index`
"""

from datetime import datetime

from airflow.decorators import dag
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/flickr_thumbs_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
One-time run DAG to remove progressively all the old Flickr thumbnails,
as they were determined to be unsuitable for the Openverse UI requirements.
"""

import logging
from datetime import timedelta
from textwrap import dedent
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/maintenance/add_license_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
the `meta_data` column are updated, the DAG will only run the first and the
last step, logging the statistics.
"""

import csv
import logging
from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/maintenance/airflow_log_cleanup_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- maxLogAgeInDays:<INT> - Optional
- enableDelete:<BOOLEAN> - Optional
"""

from datetime import datetime, timedelta

import jinja2
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/oauth2/authorize_dag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""# OAuth Provider Authorization"""

from datetime import datetime

from airflow.models import DAG
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/oauth2/token_refresh_dag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""# OAuth Provider Token Refresh"""

from datetime import datetime

from airflow.models import DAG
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/popularity/popularity_refresh_dag_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [[Implementation Plan] Decoupling Popularity Calculations from the Data Refresh](
https://docs.openverse.org/projects/proposals/popularity_optimizations/20230420-implementation_plan_popularity_optimizations.html)
"""

import logging
from datetime import datetime

Expand Down
1 change: 1 addition & 0 deletions catalog/dags/popularity/popularity_refresh_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
`POPULARITY_REFRESH_CONFIGS` for each of our media types. This configuration info
is used to generate the dynamic Popularity Refresh dags.
"""

import os
from dataclasses import dataclass, field
from datetime import datetime, timedelta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
These DAGs are not on a schedule, and should only be run manually when new
SQL code is deployed for the calculation.
"""

from airflow import DAG

from common.constants import DAG_DEFAULT_ARGS, POSTGRES_CONN_ID
Expand Down Expand Up @@ -74,6 +75,6 @@ def create_recreate_popularity_calculation_dag(popularity_refresh: PopularityRef
recreate_popularity_calculation_dag = create_recreate_popularity_calculation_dag(
popularity_refresh
)
globals()[
recreate_popularity_calculation_dag.dag_id
] = recreate_popularity_calculation_dag
globals()[recreate_popularity_calculation_dag.dag_id] = (
recreate_popularity_calculation_dag
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/search, /id | 10 | 1000
/id/media | 10 | 1000
"""

import logging
from datetime import datetime, timedelta

Expand Down
1 change: 1 addition & 0 deletions catalog/dags/providers/provider_api_scripts/europeana.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Notes: https://pro.europeana.eu/page/search
"""

import argparse
import functools
import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
reingestion DAG, as updated data will be processed during
regular ingestion.
"""

import logging
from itertools import chain

Expand Down
1 change: 1 addition & 0 deletions catalog/dags/providers/provider_api_scripts/freesound.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
This script can be run either to ingest the full dataset or
as a dated DAG.
"""

import functools
import logging
from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/providers/provider_api_scripts/jamendo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
sample rate: 44.1 or 48 kHz
channels: 1/2
"""

import logging
from datetime import timedelta
from urllib.parse import parse_qs, urlencode, urlsplit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Notes: https://justtakeitfree.com/api/api.php
This API requires an API key. For more details, see https://github.com/WordPress/openverse/pull/2793
"""

import logging

from airflow.models import Variable
Expand Down
1 change: 1 addition & 0 deletions catalog/dags/providers/provider_api_scripts/nappy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
https://nappy.co/
"""

import logging

from common import constants
Expand Down
Loading

0 comments on commit 331b576

Please sign in to comment.