Skip to content

Commit

Permalink
Update perf-testing-setup.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
YunchuWang authored Jan 8, 2024
1 parent ee0b510 commit adedd72
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/perf-testing-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env:
TESTS_DIR_PATH: ".ci/perf_tests/k6scripts/"
PYTHON_VERSION: "3.8"
PORT: 8000
# AzureWebJobsStorage: ${{ secrets.PERFTESTSTORAGE }}

jobs:
build:
Expand All @@ -25,10 +24,6 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 'latest'
- name: Setup k6 for throughput testing
run: |
cd $GITHUB_WORKSPACE
Expand All @@ -48,17 +43,6 @@ jobs:
echo "Building Docker image with Python version ${{ env.PYTHON_VERSION }}"
docker build --build-arg PYTHON_VERSION=${{ env.PYTHON_VERSION }} --file .ci/perf_tests/dockerfiles/perf_tests.Dockerfile --tag perfimage:latest .
echo "Checking environment variables..."
echo "PYTHON_VERSION: ${{ env.PYTHON_VERSION }}"
echo "PERFTESTSTORAGE: ${AzureWebJobsStorage} ${#AzureWebJobsStorage}"
echo "PORT: ${{ env.PORT }}"
echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"

if [ -z "${{ env.PYTHON_VERSION }}" ] || [ -z "${{ secrets.PERFTESTSTORAGE }}" ] || [ -z "${{ env.PORT }}" ]; then
echo "One or more environment variables are not set. Exiting..."
exit 1
fi

echo "Running Docker container..."
container_id=$(docker run -d --privileged --shm-size="2g" --env FUNCTIONS_WORKER_RUNTIME_VERSION=${{ env.PYTHON_VERSION }} -p ${PORT}:80 -v $GITHUB_WORKSPACE/azure_functions_worker:/azure-functions-host/workers/python/${{ env.PYTHON_VERSION }}/LINUX/X64/azure_functions_worker perfimage:latest)
sleep 10 # host needs some time to start.
Expand All @@ -81,7 +65,6 @@ jobs:
docker exec $container_id sh -c "pip install py-spy"
# docker exec -d $container_id sh -c "py-spy record -p $worker_pid -o /home/site/wwwroot/helloperf.svg -f flamegraph --idle --nonblocking --rate 1500 --duration 5 &"
docker exec -d $container_id sh -c "py-spy record -p $worker_pid -o /home/site/wwwroot/helloperf.svg -f flamegraph --idle --nonblocking --rate 1500 > /home/site/wwwroot/py-spy.log 2>&1 &"
# docker exec $container_id sh -c "py-spy record -p $worker_pid -o /home/site/wwwroot/helloperf.svg -f flamegraph --idle --nonblocking --rate 1500 --duration 5"
sleep 2 # Give it a moment to start
py_spy_id=$(docker exec $container_id sh -c "ps aux | grep '[p]y-spy record'" | awk '{print $2}')
echo "py_spy_id=$py_spy_id" >> $GITHUB_ENV
Expand All @@ -96,8 +79,7 @@ jobs:
docker exec $container_id sh -c "kill -2 $py_spy_id"
py_spy_id=$(docker exec $container_id sh -c "ps aux | grep '[p]y-spy record'" | awk '{print $2}')
echo "Py-Spy pid is $py_spy_id"
docker exec $container_id sh -c "ls -ltr /home/site/wwwroot"
# docker exec $container_id sh -c "find / -name helloperf.svg -not -path '/proc/*' -not -path '/sys/*' -not -path '/dev/*'"
# docker exec $container_id sh -c "ls -ltr /home/site/wwwroot"
docker cp $container_id:/home/site/wwwroot/helloperf.svg .
- name: Upload profiling result to artifact
Expand Down

0 comments on commit adedd72

Please sign in to comment.