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

Scenario load tests with simulator #9292

Open
wants to merge 81 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
220114f
Add scenario tests to the CI
itstauq Sep 15, 2024
f721f73
add support to run scenario tests using mock apis
itstauq Sep 16, 2024
5225e39
Clean up 1
itstauq Sep 16, 2024
22c587b
Refactor
itstauq Sep 17, 2024
7cec793
Merge branch 'dev' into tauquir/scenario-tests
khoaguin Sep 18, 2024
b650495
some early l0 activities in sim
yashgorana Sep 18, 2024
fdb6c87
some more code
yashgorana Sep 18, 2024
ab412f2
exit early if an exception occurs
abyesilyurt Sep 18, 2024
e48b05d
revert sleep duration
abyesilyurt Sep 18, 2024
c3c1ddb
working on low-side ds workflow
khoaguin Sep 19, 2024
50646df
Merge branch 'dev' into tauquir/scenario-tests
yashgorana Sep 20, 2024
a9266aa
user on low-side submits queries and waiting for approval
khoaguin Sep 20, 2024
4abda81
[tox] create tox task for k8s bigquery sync scenario test
khoaguin Sep 20, 2024
e60ab29
fix wrong import
khoaguin Sep 20, 2024
ca356d7
register users
yashgorana Sep 20, 2024
b61559a
Merge branch 'dev' into tauquir/scenario-tests
yashgorana Sep 20, 2024
5a43d46
use unsync_guard
yashgorana Sep 20, 2024
587ae51
polish things up, separately
yashgorana Sep 23, 2024
ab685c3
l0 till bigquery.test_query
yashgorana Sep 23, 2024
63785b2
logs
yashgorana Sep 23, 2024
da9608f
to_thread worker pool create
yashgorana Sep 23, 2024
fd04063
l0 submit_query & sync
yashgorana Sep 23, 2024
eb72983
Merge branch 'dev' into tauquir/scenario-tests
khoaguin Sep 24, 2024
92d2cb6
fix lint
khoaguin Sep 24, 2024
9768691
[tests/scenario] level 2 bigquery scenario test version 2
khoaguin Sep 24, 2024
21de88a
Merge branch 'dev' into tauquir/scenario-tests
yashgorana Sep 24, 2024
0a54fd0
l0 admin high triage requests
yashgorana Sep 24, 2024
4df7fbf
Merge branch 'dev' into tauquir/scenario-tests
yashgorana Sep 24, 2024
459c1c8
Merge branch 'dev' into tauquir/scenario-tests
yashgorana Sep 25, 2024
ef70276
[[tests/scenario] admin low triggers signal when all results are avai…
khoaguin Sep 25, 2024
ea9c3e9
[test/scenarios] admin low breaking from watching sync coroutine afte…
khoaguin Sep 25, 2024
c152819
[tests/scenarios] add a coroutine for users to check results after th…
khoaguin Sep 26, 2024
8b1337d
[tests/scenarios] logs are now saved at /scenariosv2/logs/{date_time}
khoaguin Sep 26, 2024
a5306ea
Merge branch 'dev' into tauquir/scenario-tests
khoaguin Sep 26, 2024
52a0600
fix 'worker_pool_name' var name change
yashgorana Sep 26, 2024
0fff1f9
drop F841
yashgorana Sep 26, 2024
a203de9
[CI] installing `just` and running bigquery scenariov2 on k8s with ju…
khoaguin Sep 26, 2024
7bd6573
[CI] fix bash commands for `syft.test.scenario`
khoaguin Sep 26, 2024
dc9c3ce
[CI] move testing simulation scenario tests to pr-tests-stack
khoaguin Sep 26, 2024
5f30a84
[CI] checking python version
khoaguin Sep 26, 2024
f2aab94
Merge branch 'dev' into tauquir/scenario-tests
yashgorana Sep 26, 2024
6c1267b
drop scenarios
yashgorana Sep 26, 2024
74f6694
tweaked logging
yashgorana Sep 26, 2024
2ca51cf
attempt to make things common
yashgorana Sep 26, 2024
1418756
rename bq api user flows
yashgorana Sep 26, 2024
2227c3a
refactor bq_create_pool
yashgorana Sep 26, 2024
de4b749
register users concurrently
yashgorana Sep 26, 2024
4726bee
admin api concurrency
yashgorana Sep 26, 2024
c4dae92
de-nest sim_entrypoint wrapper
yashgorana Sep 26, 2024
dae5bbe
admin sync refactor
yashgorana Sep 26, 2024
7a98935
add .logs ignore
yashgorana Sep 26, 2024
b5e3f12
fix merge conflicts
yashgorana Sep 26, 2024
2f9fe3d
drop unsync
yashgorana Sep 26, 2024
2abe420
remove unused import. upper case TODO
khoaguin Sep 27, 2024
83ac856
Merge branch 'dev' into tauquir/scenario-tests
khoaguin Sep 27, 2024
bb13be4
[tests/scenarios] always print side-type after "Admin" in logs
khoaguin Sep 27, 2024
3a2a0ca
[tests/scenarios] adding a try catch in `admin_sync`
khoaguin Sep 27, 2024
36be022
[tox] trying to fix `No interpreter found for Python 3.12 in system t…
khoaguin Sep 27, 2024
a3d2470
[CI] install just to `/usr/local/bin`
khoaguin Sep 27, 2024
10de6ec
[tox] change `deps` for `stack.test.scenario.k8s`
khoaguin Sep 27, 2024
c063522
[CI] update uv, tox and uv-tox version
khoaguin Sep 27, 2024
b0f7971
[CI] update uv and tox to latest versions for all tasks
khoaguin Sep 27, 2024
9185cf9
just wait-pods
yashgorana Sep 29, 2024
c7ee5fe
[CI] reverted to use `uv==0.4.1 tox==4.18.0 tox-uv==1.11.2`
khoaguin Sep 30, 2024
9aa6732
[tox] separate simulation k8s test for L0 and L2
khoaguin Sep 30, 2024
53a4cf8
[CI] clean up k3d for simulation k8 tests
khoaguin Sep 30, 2024
5bb27ee
[test/scenarios] launching python server if testing on python
khoaguin Sep 30, 2024
ff6f168
[tests/scenarios] launching python nodes with producer and consumers
khoaguin Sep 30, 2024
40c9387
[tests/scenario] l0 and l2 bigquery tests work with python servers
khoaguin Sep 30, 2024
6cdd3d6
[CI] fix the ORCHESTRA_DEPLOYMENT_TYPE env variable set to wrong value
khoaguin Sep 30, 2024
99f78c2
Merge branch 'dev' into tauquir/scenario-tests
khoaguin Sep 30, 2024
723d21b
[CI] fix tox command for scenario k8s test
khoaguin Sep 30, 2024
53481ca
[CI] re-enable `test-syft-scenario` and add `test-syft-scenario-sync`…
khoaguin Sep 30, 2024
32ea796
[tox] add necessary pip packages for syft scenario tests
khoaguin Sep 30, 2024
dce3ce4
DeploymentType.REMOTE as default - k8s first
yashgorana Sep 30, 2024
23ac669
refactor orchestra stuff
yashgorana Sep 30, 2024
f243637
[tests/scenario] fix small bug
khoaguin Oct 1, 2024
1f10273
[CI] collecting logs for `tests-simulation-scenario-k8s`
khoaguin Oct 1, 2024
9fb8512
[CI] collecting logs for `tests-simulation-scenario-sync-k8s`
khoaguin Oct 1, 2024
e68ae99
[CI] collecting logs for syft-scenario and syft-scenario-sync tests
khoaguin Oct 1, 2024
454ecbf
fix ActionObject.get_sync_dependencies
abyesilyurt Oct 1, 2024
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
145 changes: 136 additions & 9 deletions .github/workflows/pr-tests-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
khoaguin marked this conversation as resolved.
Show resolved Hide resolved
uv --version

- name: Run syft backend base image building test
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -328,7 +328,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -471,7 +471,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -597,7 +597,7 @@ jobs:
if: steps.changes.outputs.syft == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -657,7 +657,7 @@ jobs:
if: steps.changes.outputs.syft == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -734,7 +734,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
Expand Down Expand Up @@ -875,7 +875,7 @@ jobs:
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.2.17 tox==4.16.0 tox-uv==1.9.0
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version
- name: Get uv cache dir
if: steps.changes.outputs.stack == 'true'
Expand Down Expand Up @@ -956,3 +956,130 @@ jobs:
export PATH=`pwd`:$PATH
k3d cluster delete bigquery-high || true
k3d cluster delete bigquery-low || true

pr-tests-simulation-scenario-k8s:
strategy:
max-parallel: 99
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
fail-fast: false

runs-on: ${{matrix.os}}

steps:
- name: Permission to home directory
run: |
sudo chown -R $USER:$USER $HOME
- uses: actions/checkout@v4
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: steps.changes.outputs.stack == 'true'
with:
python-version: ${{ matrix.python-version }}

- name: Add K3d Registry
run: |
sudo python ./scripts/patch_hosts.py --add-k3d-registry

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: false

# free 10GB of space
- name: Remove unnecessary files
if: matrix.os == 'ubuntu-latest'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker image prune --all --force
docker builder prune --all --force
docker system prune --all --force

- name: Install pip dependencies
if: steps.changes.outputs.stack == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.16 tox==4.20.0 tox-uv==1.13.0
uv --version

- name: Get uv cache dir
if: steps.changes.outputs.stack == 'true'
id: pip-cache
shell: bash
run: |
echo "dir=$(uv cache dir)" >> $GITHUB_OUTPUT

- name: Load github cache
uses: actions/cache@v4
if: steps.changes.outputs.stack == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-uv-py${{ matrix.python-version }}

- name: Install kubectl
if: steps.changes.outputs.stack == 'true'
run: |
# cleanup apt version
sudo apt remove kubectl || true
# install kubectl 1.27
curl -LO https://dl.k8s.io/release/v1.27.2/bin/linux/amd64/kubectl
chmod +x kubectl
sudo install kubectl /usr/local/bin;

- name: Install helm
if: steps.changes.outputs.stack == 'true'
run: |
# install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

- name: Install just
if: steps.changes.outputs.stack == 'true'
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin

- name: Run scenario tests
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
env:
ORCHESTRA_DEPLOYMENT_TYPE: "${{ matrix.deployment-type }}"
BUMP_VERSION: "${{ matrix.bump-version }}"
TOX_PYTHON: python${{ matrix.python-version }}
shell: bash
run: |
K3D_VERSION=v5.6.3
DEVSPACE_VERSION=v6.3.12
# install k3d
wget https://github.com/k3d-io/k3d/releases/download/${K3D_VERSION}/k3d-linux-amd64
mv k3d-linux-amd64 k3d
chmod +x k3d
export PATH=`pwd`:$PATH
k3d version
curl -sSL https://github.com/loft-sh/devspace/releases/download/${DEVSPACE_VERSION}/devspace-linux-amd64 -o ./devspace
chmod +x devspace
devspace version
tox -e stack.test.scenario.k8s

# todo: collect logs
khoaguin marked this conversation as resolved.
Show resolved Hide resolved

- name: Cleanup k3d
if: steps.changes.outputs.stack == 'true' && failure()
shell: bash
run: |
export PATH=`pwd`:$PATH
k3d cluster delete syft-high || true
k3d cluster delete syft-low || true
k3d registry delete k3d-registry.localhost || true
85 changes: 85 additions & 0 deletions .github/workflows/pr-tests-syft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,91 @@ jobs:
max_attempts: 3
command: tox -e syft.test.notebook

pr-tests-syft-scenario:
if: ${{ false }}
strategy:
max-parallel: 99
matrix:
# TODO try enabling on other OS
os: [ubuntu-latest]
python-version: ["3.12"]
deployment-type: ["python"]
bump-version: ["False"]
include:
- python-version: "3.11"
os: "ubuntu-latest"
deployment-type: "python"
- python-version: "3.10"
os: "ubuntu-latest"
deployment-type: "python"
- python-version: "3.12"
os: "ubuntu-latest"
deployment-type: "python"
bump-version: "True"

runs-on: ${{ matrix.os }}
steps:
# - name: Permission to home directory
# if: matrix.os == 'ubuntu-latest'
# run: |
# sudo chown -R $USER:$USER $HOME
- name: "clean .git/config"
if: matrix.os == 'windows-latest'
continue-on-error: true
shell: bash
run: |
echo "deleting ${GITHUB_WORKSPACE}/.git/config"
rm ${GITHUB_WORKSPACE}/.git/config

- uses: actions/checkout@v4

- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
base: ${{ github.ref }}
token: ${{ github.token }}
filters: .github/file-filters.yml

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
with:
python-version: ${{ matrix.python-version }}

- name: Install pip packages
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
run: |
python -m pip install --upgrade pip
pip install uv==0.4.1 tox==4.18.0 tox-uv==1.11.2
uv --version

- name: Get uv cache dir
id: pip-cache
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
shell: bash
run: |
echo "dir=$(uv cache dir)" >> $GITHUB_OUTPUT

- name: Load github cache
uses: actions/cache@v4
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-uv-py${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-uv-py${{ matrix.python-version }}-

- name: Run scenario tests
if: steps.changes.outputs.syft == 'true' || steps.changes.outputs.notebooks_scenario == 'true'
env:
ORCHESTRA_DEPLOYMENT_TYPE: "${{ matrix.deployment-type }}"
BUMP_VERSION: "${{ matrix.bump-version }}"
TOX_PYTHON: python${{ matrix.python-version }}
shell: bash
run: |
tox -e syft.test.scenario

pr-tests-syft-notebook-scenario:
strategy:
max-parallel: 99
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,8 @@ notebooks/scenarios/bigquery/sync/*.json
notebooks/scenarios/bigquery/sync/*.json.lock
notebooks/tutorials/version-upgrades/*.yaml
notebooks/tutorials/version-upgrades/*.blob

notebooks/scenarios/bigquery/sync/emails.json

# logs dir generated by sim tests
.logs

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
always_run: true
- id: name-tests-test
always_run: true
exclude: ^(.*/tests/utils/)|^(.*fixtures.py)|^(tests/scenarios/bigquery/helpers)
exclude: ^(.*/tests/utils/)|^(.*fixtures.py)|^(tests/scenariosv2/(sim|flows))
- id: requirements-txt-fixer
always_run: true
- id: mixed-line-ending
Expand Down
7 changes: 3 additions & 4 deletions packages/syft/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,9 @@ test_plugins =
faker
distro
dynaconf
; pytest-asyncio
; pytest-timeout
; anyio
; unsync
pytest-asyncio
pytest-timeout
anyio

[options.entry_points]
console_scripts =
Expand Down
8 changes: 6 additions & 2 deletions packages/syft/src/syft/util/test_helpers/apis/mock/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
from .data import schema_dict


def make_schema(settings, worker_pool_name) -> Callable:
def make_schema(
settings,
worker_pool_name,
path="bigquery.schema",
) -> Callable:
updated_settings = {
"calls_per_min": 5,
"rate_limiter_enabled": True,
"schema_dict": schema_dict,
} | settings

@sy.api_endpoint(
path="bigquery.schema",
path=path,
description="This endpoint allows for visualising the metadata of tables available in BigQuery.",
settings=updated_settings,
helper_functions=[is_within_rate_limit],
Expand Down
5 changes: 4 additions & 1 deletion packages/syft/src/syft/util/test_helpers/worker_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def build_and_launch_worker_pool_from_docker_str(
print(result)
# assert 'success' in str(result.message)

if environment == "remote":
# scale_to > 1 is valid for scale up
# scale_to = 0 is valid for removing all pods
# scale_to < 0 should return error from server
if environment == "remote" and scale_to != 1:
result = client.worker_pools.scale(number=scale_to, pool_name=worker_pool_name)
print(result)

Expand Down
Empty file added test_helpers/__init__.py
Empty file.
Loading
Loading