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

add load test with default values #32

Merged
merged 6 commits into from
Feb 1, 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 .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ S3FILESTORE__AWS_ACCESS_KEY_ID=_placeholder
S3FILESTORE__AWS_SECRET_ACCESS_KEY=_placeholder
S3FILESTORE__SIGNATURE_VERSION=s3v4

MDTRANSLATOR_URL=http://127.0.0.1:3000/translates
MDTRANSLATOR_URL=http://127.0.0.1:3000/translates
43 changes: 43 additions & 0 deletions .github/workflows/load_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Load Test
on:
workflow_dispatch:

jobs:
load-test:
name: H2.0 Load Test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run Load Test
env:
SRC_TITLE: 'EPA ScienceHub'
SRC_URL: 'https://pasteur.epa.gov/metadata.json'
SRC_OWNER_ORG: '82b85475-f85d-404a-b95b-89d1a42e9f6b'
SRC_SOURCE_TYPE: 'datajson'
CKAN_URL: ${{secrets.CKAN_URL_STAGING}}
CKAN_API_TOKEN: ${{secrets.CKAN_API_TOKEN_STAGING}}
run: |
source .venv/bin/activate
poetry run python scripts/load_test.py
29 changes: 29 additions & 0 deletions scripts/load_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

import os
import sys

sys.path.insert(1, "/".join(os.path.realpath(__file__).split("/")[0:-2]))

from harvester.harvest import HarvestSource # noqa E402

title = os.environ['SRC_TITLE']
url = os.environ['SRC_URL']
owner_org = os.environ['SRC_OWNER_ORG']
source_type = os.environ['SRC_SOURCE_TYPE']

print('Running load test for the following harvest config')
print(f'title: {title}')
print(f'url: {url}')
print(f'owner_org: {owner_org}')
print(f'source_type: {source_type}')

harvest_source = HarvestSource(
title,
url,
owner_org,
source_type
)

harvest_source.get_record_changes()
harvest_source.synchronize_records()
harvest_source.report()
Loading