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

Package Sync #235

Merged
merged 55 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5f2c3e1
sync
shughes-uk Aug 4, 2022
6146ac9
Restructure to use package_sync: no more setup/cleanup of coiled
Aug 9, 2022
828d261
Dropped import in merge
Aug 9, 2022
09e151c
I guess we should run these.
Aug 9, 2022
b1c4c36
Fix condition
Aug 9, 2022
1b5f171
Merge branch 'main' into irose/package-sync-as-default
Aug 12, 2022
d0ad7f1
Merge branch 'main' into irose/package-sync-as-default
Aug 16, 2022
b200554
Skip output db, in combine step, which might appear if there are CI
Aug 16, 2022
fc40b10
Always upload static site
Aug 16, 2022
f17fe0c
test ci
Aug 17, 2022
a9ed685
Merge branch 'main' into irose/package-sync-as-default
Aug 17, 2022
393681a
test ci
Aug 19, 2022
5b7c0c1
test ci
Aug 22, 2022
80a87fc
Merge branch 'main' into irose/package-sync-as-default
Aug 23, 2022
4d4b385
Merge branch 'main' into irose/package-sync-as-default
Aug 23, 2022
69c6369
test ci
Aug 24, 2022
21cf14d
Rerun CI
jrbourbeau Aug 24, 2022
dea73fb
Test ci
Aug 24, 2022
e962837
Test ci
Aug 24, 2022
5ff1ac7
Test ci
Aug 24, 2022
ef2f850
test ci
Aug 25, 2022
984987f
test ci
Aug 25, 2022
b8cbcbc
Use package_sync and benchmarking infrastructure in spill tests
Aug 25, 2022
6c2665e
Remove now-unneeded workaround
Aug 25, 2022
e08de70
Skip test_spilling for now
Aug 25, 2022
9e7af44
Bump default image size
Aug 26, 2022
a0debfc
Test CI
Aug 26, 2022
6772842
Un-skip
Aug 26, 2022
c62fa87
test ci
Aug 26, 2022
97bf05c
Test CI
Aug 26, 2022
161c99c
Test CI
Aug 29, 2022
d7a8a06
Merge branch 'main' into irose/package-sync-as-default
Aug 30, 2022
1cfc431
Update fixtures
Aug 30, 2022
6ddea66
Try bumping instance type for small_cluster
Aug 30, 2022
fc0225e
Merge branch 'main' into irose/package-sync-as-default
Aug 30, 2022
928d176
Revert "Try bumping instance type for small_cluster"
Aug 30, 2022
e1a0ffb
Try an SSD instance for spill tests
Aug 30, 2022
e1972c2
Revert "Try an SSD instance for spill tests"
Aug 30, 2022
576e855
Reduce the spill test to 2x memory, try to avoid a test that takes 30
Aug 30, 2022
2ca5adc
Revert
Aug 30, 2022
1271307
Test ci
Aug 31, 2022
7e0fe7e
Test ci
Aug 31, 2022
99c2d4d
Try installing git dep for upstream
Aug 31, 2022
5d13ab9
Did we catch something
Aug 31, 2022
6ab38a3
Revert "Did we catch something"
Sep 1, 2022
347c499
Test CI
Sep 1, 2022
1566741
test ci
Sep 2, 2022
1bdcda6
Test CI
Sep 6, 2022
b272706
Test CI
Sep 8, 2022
d46ff90
Test CI
Sep 14, 2022
db098a2
Merge branch 'main' into irose/package-sync-as-default
Sep 14, 2022
9c54eab
clean up after merge
Sep 14, 2022
e673418
Merge branch 'main' into irose/package-sync-as-default
Sep 14, 2022
636ad71
Declare bankruptcy on cluster startup time
Sep 14, 2022
3271051
Apply suggestions from code review
ian-r-rose Sep 15, 2022
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
178 changes: 19 additions & 159 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
tags:
- '*'
- "*"
pull_request:
schedule:
# Runs "At 00:01" (see https://crontab.guru)
Expand All @@ -22,104 +22,16 @@ defaults:
shell: bash -l {0}

jobs:
software:
name: Setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up environment
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
use-mamba: true
condarc-file: ci/condarc
python-version: ${{ matrix.python-version }}
environment-file: ci/environment.yml

- name: Check upstream
run: |
if [[ ${{ github.event_name }} == "pull_request" ]]
then
REF="HEAD^2"
else
REF="HEAD"
fi

COMMIT="$(git log -n 1 --pretty=format:%s $REF)"
if [[ "$COMMIT" == *"test-upstream"* || ${{ github.event_name }} == "schedule" ]]
then
TEST_UPSTREAM="true"
AB_BASELINE="coiled-upstream-py3.9 coiled-0.1.0-py3.9"
else
TEST_UPSTREAM="false"
AB_BASELINE="coiled-latest-py3.9 coiled-0.1.0-py3.9"
fi

# Put TEST_UPSTREAM into $GITHUB_ENV so it can be used in subsequent workflow steps
echo $TEST_UPSTREAM
echo TEST_UPSTREAM=$TEST_UPSTREAM >> $GITHUB_ENV

# Put env variables into files so it can be downloaded in subsequent workflow jobs
echo $TEST_UPSTREAM > test_upstream.txt
echo $AB_BASELINE > ab_baseline.txt

- name: Build Coiled Software Environment
env:
DASK_COILED__TOKEN: ${{ secrets.COILED_BENCHMARK_BOT_TOKEN }}
run: |
PYTHON_VERSION_FORMATTED=$(echo "${{ matrix.python-version }}" | sed 's/\.//g' )
NAME_HEAD=dask-engineering/coiled-runtime-${{ github.event_name }}
NAME_TAIL=$GITHUB_RUN_ID-py$PYTHON_VERSION_FORMATTED
if [[ ${{ github.event_name }} = 'pull_request' ]]
then
NAME_MID=${{ github.event.number }}
else
NAME_MID=$GITHUB_REF_TYPE-$(echo "$GITHUB_REF_NAME" | sed 's/\./-/g' )
fi
# env name can only contain lowercase ASCII letters, numbers, hyphens and underscores
COILED_SOFTWARE_NAME=$NAME_HEAD-$(echo $NAME_MID-$NAME_TAIL | tr 'A-Z' 'a-z' | sed -r 's/[^a-z0-9_-]/_/g')

# Create conda environment.yaml file for the latest software environment
python ci/create_latest_runtime_meta.py
ENV_FILE=coiled_software_environment.yaml
cat $ENV_FILE

mamba install coiled
echo "Creating Coiled software environment for $COILED_SOFTWARE_NAME"
coiled env create --name $COILED_SOFTWARE_NAME --conda $ENV_FILE

# Put COILED_SOFTWARE_NAME into a file so it can be downloaded in subsequent workflow jobs
echo $COILED_SOFTWARE_NAME > software_name.txt

- name: Upload environment file
uses: actions/upload-artifact@v3
with:
name: software-environment-py${{ matrix.python-version }}
path: |
coiled_software_environment.yaml
software_name.txt
test_upstream.txt
ab_baseline.txt

runtime:
name: Runtime - ${{ matrix.os }}, Python ${{ matrix.python-version }}, Runtime ${{ matrix.runtime-version }}
needs: software
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.9"]
runtime-version: ["latest", "0.0.4", "0.1.0"]
runtime-version: ["upstream", "latest", "0.0.4", "0.1.0"]

steps:
- uses: actions/checkout@v2
Expand All @@ -135,16 +47,12 @@ jobs:
python-version: ${{ matrix.python-version }}
environment-file: ci/environment.yml

- name: Download software environment assets
if: matrix.runtime-version == 'latest'
uses: actions/download-artifact@v3
with:
name: software-environment-py${{ matrix.python-version }}

- name: Install coiled-runtime
env:
COILED_RUNTIME_VERSION: ${{ matrix.runtime-version }}
run: source ci/scripts/install_coiled_runtime.sh
run: |
python ci/create_runtime_meta.py
source ci/scripts/install_coiled_runtime.sh

- name: Run Coiled Runtime Tests
id: test
Expand All @@ -166,15 +74,14 @@ jobs:

benchmarks:
name: Benchmarks - ${{ matrix.os }}, Python ${{ matrix.python-version }}, Runtime ${{ matrix.runtime-version }}
needs: software
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.9"]
runtime-version: ["latest", "0.0.4", "0.1.0"]
runtime-version: ["upstream", "latest", "0.0.4", "0.1.0"]

steps:
- uses: actions/checkout@v2
Expand All @@ -190,16 +97,12 @@ jobs:
python-version: ${{ matrix.python-version }}
environment-file: ci/environment.yml

- name: Download software environment assets
if: matrix.runtime-version == 'latest'
uses: actions/download-artifact@v3
with:
name: software-environment-py${{ matrix.python-version }}

- name: Install coiled-runtime
env:
COILED_RUNTIME_VERSION: ${{ matrix.runtime-version }}
run: source ci/scripts/install_coiled_runtime.sh
run: |
python ci/create_runtime_meta.py
source ci/scripts/install_coiled_runtime.sh

- name: Run benchmarking tests
id: benchmarking_tests
Expand All @@ -221,15 +124,14 @@ jobs:

stability:
name: Stability - ${{ matrix.os }}, Python ${{ matrix.python-version }}, Runtime ${{ matrix.runtime-version }}
needs: software
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.8", "3.9", "3.10"]
runtime-version: ["latest", "0.0.4", "0.1.0"]
runtime-version: ["upstream", "latest", "0.0.4", "0.1.0"]
include:
- python-version: "3.9"
runtime-version: "latest"
Expand All @@ -252,16 +154,12 @@ jobs:
python-version: ${{ matrix.python-version }}
environment-file: ci/environment.yml

- name: Download software environment assets
if: matrix.runtime-version == 'latest'
uses: actions/download-artifact@v3
with:
name: software-environment-py${{ matrix.python-version }}

- name: Install coiled-runtime
env:
COILED_RUNTIME_VERSION: ${{ matrix.runtime-version }}
run: source ci/scripts/install_coiled_runtime.sh
run: |
python ci/create_runtime_meta.py
source ci/scripts/install_coiled_runtime.sh

- name: Run stability tests
id: stability_tests
Expand All @@ -282,39 +180,6 @@ jobs:
name: stability-${{ matrix.os }}-${{ matrix.runtime-version }}-py${{ matrix.python-version }}
path: stability-${{ matrix.os }}-${{ matrix.runtime-version }}-py${{ matrix.python-version }}.db

cleanup:
needs: [software, runtime, benchmarks, stability]
if: always()
name: Cleanup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install coiled
run: python -m pip install coiled

- name: Download software environment assets
uses: actions/download-artifact@v3
with:
name: software-environment-py${{ matrix.python-version }}

- name: Remove Coiled software environment
env:
DASK_COILED__TOKEN: ${{ secrets.COILED_BENCHMARK_BOT_TOKEN }}
run: |
SOFTWARE_NAME=$(cat software_name.txt)
echo "Deleting $SOFTWARE_NAME"
coiled env delete $SOFTWARE_NAME

process-results:
needs: [runtime, benchmarks, stability]
name: Combine separate benchmark results
Expand All @@ -341,7 +206,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.RUNTIME_CI_BOT_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNTIME_CI_BOT_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2 # this is needed for boto for some reason
AWS_DEFAULT_REGION: us-east-2 # this is needed for boto for some reason
DB_NAME: benchmark.db
run: |
aws s3 cp s3://coiled-runtime-ci/benchmarks/$DB_NAME . || true
Expand All @@ -356,15 +221,15 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.RUNTIME_CI_BOT_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.RUNTIME_CI_BOT_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2 # this is needed for boto for some reason
AWS_DEFAULT_REGION: us-east-2 # this is needed for boto for some reason
DB_NAME: benchmark.db
run: |
aws s3 cp $DB_NAME s3://coiled-runtime-ci/benchmarks/

- name: Upload benchmark results as artifact
uses: actions/upload-artifact@v3
with:
name: benchmark.db
name: benchmark
path: benchmark.db

regressions:
Expand All @@ -380,7 +245,7 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: benchmark.db
name: benchmark

- name: Set up environment
uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -451,7 +316,7 @@ jobs:

- uses: actions/download-artifact@v3
with:
name: benchmark.db
name: benchmark

- name: Set up environment
uses: conda-incubator/setup-miniconda@v2
Expand All @@ -461,13 +326,8 @@ jobs:
python-version: "3.9"
environment-file: ci/environment-dashboard.yml

- name: Download software environment assets
uses: actions/download-artifact@v3
with:
name: software-environment-py3.9

- name: Generate dashboards
run: python dashboard.py -d benchmark.db -o static -b $(cat ab_baseline.txt)
run: python dashboard.py -d benchmark.db -o static -b coiled-latest-py3.9 coiled-upstream-py3.9

- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ The `coiled-runtime` test suite can be run locally with the following steps:
the Coiled Dask Engineering AWS S3 account.
2. Create a Python environment and install development dependencies as
specified in `ci/environment.yml`.
3. (Optional) If testing against an unreleased version of `coiled-runtime`,
create a Coiled software environment with the unreleased `coiled-runtime` installed
and set a local `COILED_SOFTWARE_NAME` environment variable to the name
of the software environment (e.g. `export COILED_SOFTWARE_NAME="account/software-name"`)
3. Install a coiled runtime environment. This might be from one of the environments
listed in ``environments/``, or it could be a development environment if you are
testing feature branches of dask or distributed. This test suite is configured
to run Coiled's ``package_sync`` feature, so your local environment should be copied
to the cluster.
4. Run tests with `python -m pytest tests`

Additionally, tests are automatically run on pull requests to this repository.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Declare bankruptcy for cluster startup time

Revision ID: 2764a4f5582b
Revises: 924e9b1430e1
Create Date: 2022-09-14 11:45:46.024184

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "2764a4f5582b"
down_revision = "924e9b1430e1"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.execute(
"""
delete from test_run
where originalname = 'test_default_cluster_spinup_time'
and path = 'benchmarks/test_coiled.py';
"""
)


def downgrade() -> None:
pass
24 changes: 14 additions & 10 deletions ci/create_latest_runtime_meta.py → ci/create_runtime_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import shlex
import subprocess
import sys
from distutils.util import strtobool

import yaml
from jinja2 import Environment, FileSystemLoader, select_autoescape
Expand Down Expand Up @@ -38,15 +37,20 @@ def main():
if package_name == "python":
requirements[idx] = f"python =={python_version}"

# Optionally use the development version of `dask` and `distributed`
# from `dask/label/dev` conda channel
upstream = strtobool(os.environ.get("TEST_UPSTREAM", "false"))
if upstream:
upstream_packages = {"dask", "distributed"}
for idx, req in enumerate(requirements):
package_name = Requirement(req).name
if package_name in upstream_packages:
requirements[idx] = get_latest_conda_build(package_name)
if os.environ.get("COILED_RUNTIME_VERSION", "unknown") == "upstream":
requirements = [
r
for r in requirements
if Requirement(r).name not in {"dask", "distributed"}
]
requirements.append(
{
"pip": [
"git+https://github.com/dask/dask@main",
"git+https://github.com/dask/distributed@main",
]
}
)

# File compatible with `mamba env create --file <...>`
env = {
Expand Down
Loading