From 685f585efed17203322929c99ae47e8944b5f7f3 Mon Sep 17 00:00:00 2001 From: Tyler Burton Date: Thu, 1 Feb 2024 16:13:00 -0600 Subject: [PATCH] updates to script --- .env | 2 +- .github/workflows/load_test.yml | 23 ++++++++++++++++++----- scripts/load_test.py | 13 +++++++------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.env b/.env index 74b8ffed..29e14bee 100644 --- a/.env +++ b/.env @@ -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 \ No newline at end of file +MDTRANSLATOR_URL=http://127.0.0.1:3000/translates diff --git a/.github/workflows/load_test.yml b/.github/workflows/load_test.yml index 3eb3657a..a384d470 100644 --- a/.github/workflows/load_test.yml +++ b/.github/workflows/load_test.yml @@ -1,4 +1,4 @@ -name: Harvester 2.0 Load Test +name: Load Test on: workflow_dispatch: @@ -7,6 +7,8 @@ jobs: 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: @@ -15,10 +17,20 @@ jobs: run: python -c "import sys; print(sys.version)" - name: Install Poetry uses: snok/install-poetry@v1 - - name: - run: - poetry install - - name: Run Test + 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' @@ -27,4 +39,5 @@ jobs: CKAN_URL: ${{secrets.CKAN_URL}} CKAN_API_TOKEN: ${{secrets.CKAN_API_TOKEN}} run: | + source .venv/bin/activate poetry run python scripts/load_test.py diff --git a/scripts/load_test.py b/scripts/load_test.py index dabda2ae..4dfc53e9 100644 --- a/scripts/load_test.py +++ b/scripts/load_test.py @@ -11,18 +11,19 @@ owner_org = os.environ['SRC_OWNER_ORG'] source_type = os.environ['SRC_SOURCE_TYPE'] -print(title) -print(url) -print(owner_org) -print(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.get_record_changes() harvest_source.synchronize_records() harvest_source.report()