-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5384722
commit fd2fdf5
Showing
1 changed file
with
94 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,77 +27,6 @@ jobs: | |
curl https://github.com/loadimpact/k6/releases/download/v0.28.0/k6-v0.28.0-linux64.tar.gz -L | tar xvz --strip-components 1 | ||
chmod 755 ./k6 | ||
./k6 version | ||
- name: Install dependencies and the worker | ||
run: | | ||
python -m pip install -q --upgrade pip | ||
python -m pip install -q --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U -e .[dev] | ||
python -m pip install -q --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre | ||
python setup.py build | ||
python setup.py webhost --branch-name=dev | ||
python setup.py extension | ||
- name: Build and Run the Docker image | ||
run: | | ||
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 "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. | ||
echo "Container ID is $container_id" | ||
echo "Fetching Docker container logs..." | ||
docker logs $container_id | ||
worker_pid=$(docker exec $container_id sh -c "ps aux | grep '[p]ython'" | awk '{print $2}') | ||
echo "Python worker process id is $worker_pid" | ||
echo "container_id=$container_id" >> $GITHUB_ENV | ||
echo "worker_pid=$worker_pid" >> $GITHUB_ENV | ||
|
||
- name: Validate if the functions are now running | ||
run: | | ||
curl --get http://localhost:${PORT}/api/${{ matrix.test_to_run }} | ||
- name: Start py-spy in the background | ||
run: | | ||
echo "Starting py-spy in background..." | ||
echo "Container id is $container_id" | ||
docker exec $container_id sh -c "pip install py-spy" | ||
docker exec $container_id sh -c "mkdir /home/profiling_reports" | ||
report_name="azpyfuncpprofiling_${{ github.run_id }}.svg" | ||
# docker exec -d $container_id sh -c "py-spy record -p $worker_pid -o /home/site/wwwroot/$report_name -f flamegraph --idle --nonblocking --rate 1500 > /home/site/wwwroot/py-spy.log 2>&1 &" | ||
docker exec -d $container_id sh -c "py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f flamegraph --idle --nonblocking --rate 1500 > /home/site/wwwroot/py-spy.log 2>&1 &" | ||
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 | ||
echo "report_name=$report_name" >> $GITHUB_ENV | ||
- name: Run Throughput tests | ||
run: | | ||
chmod 755 .ci/perf_tests/run-perftests.sh | ||
.ci/perf_tests/run-perftests.sh localhost $PORT ${{ env.TESTS_DIR_PATH }} ${{ matrix.test_to_run }} | ||
echo "Tests completed, terminating py-spy..." | ||
docker exec $container_id cat /home/site/wwwroot/py-spy.log | ||
echo "Py-Spy pid is $py_spy_id" | ||
docker exec $container_id sh -c "kill -2 $py_spy_id" | ||
sleep 2 | ||
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" | ||
mkdir profiling_reports | ||
chmod 777 profiling_reports | ||
docker cp $container_id:/home/profiling_reports/$report_name profiling_reports | ||
ls -ltr profiling_reports | ||
# calculate sas report end time | ||
current_time=$(date -u '+%Y-%m-%dT%H:%MZ') | ||
end_time=$(date -u -d "$current_time 30 minutes" '+%Y-%m-%dT%H:%MZ' 2>/dev/null || date -u -D '%Y-%m-%dT%H:%MZ' -d "+30 minutes" '+%Y-%m-%dT%H:%MZ') | ||
echo "end_time=$end_time" >> $GITHUB_ENV | ||
- name: Upload SVG to Azure Blob Storage | ||
uses: bacongobbler/[email protected] | ||
with: | ||
source_dir: 'profiling_reports' # Directory containing the $report_name file | ||
container_name: 'profiling' | ||
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} | ||
sync: 'false' | ||
|
||
- name: Generate Blob SAS URL | ||
uses: Azure/cli@v1 | ||
with: | ||
|
@@ -107,7 +36,6 @@ jobs: | |
--container-name 'profiling' \ | ||
--name $report_name \ | ||
--permissions r \ | ||
--expiry $end_time \ | ||
--output tsv \ | ||
--connection-string ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}) | ||
url=$(az storage blob url \ | ||
|
@@ -118,10 +46,101 @@ jobs: | |
sas_url="$url?$sas" | ||
echo "SVG SAS URL: $sas_url" | ||
echo "sas_url=$sas_url" >> $GITHUB_ENV | ||
# - name: Install dependencies and the worker | ||
# run: | | ||
# python -m pip install -q --upgrade pip | ||
# python -m pip install -q --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U -e .[dev] | ||
# python -m pip install -q --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple -U azure-functions --pre | ||
# python setup.py build | ||
# python setup.py webhost --branch-name=dev | ||
# python setup.py extension | ||
# - name: Build and Run the Docker image | ||
# run: | | ||
# 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 "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. | ||
# echo "Container ID is $container_id" | ||
# echo "Fetching Docker container logs..." | ||
# docker logs $container_id | ||
# worker_pid=$(docker exec $container_id sh -c "ps aux | grep '[p]ython'" | awk '{print $2}') | ||
# echo "Python worker process id is $worker_pid" | ||
# echo "container_id=$container_id" >> $GITHUB_ENV | ||
# echo "worker_pid=$worker_pid" >> $GITHUB_ENV | ||
|
||
# - name: Validate if the functions are now running | ||
# run: | | ||
# curl --get http://localhost:${PORT}/api/${{ matrix.test_to_run }} | ||
|
||
# - name: Start py-spy in the background | ||
# run: | | ||
# echo "Starting py-spy in background..." | ||
# echo "Container id is $container_id" | ||
# docker exec $container_id sh -c "pip install py-spy" | ||
# docker exec $container_id sh -c "mkdir /home/profiling_reports" | ||
# report_name="azpyfuncpprofiling_${{ github.run_id }}.svg" | ||
# # docker exec -d $container_id sh -c "py-spy record -p $worker_pid -o /home/site/wwwroot/$report_name -f flamegraph --idle --nonblocking --rate 1500 > /home/site/wwwroot/py-spy.log 2>&1 &" | ||
# docker exec -d $container_id sh -c "py-spy record -p $worker_pid -o /home/profiling_reports/$report_name -f flamegraph --idle --nonblocking --rate 1500 > /home/site/wwwroot/py-spy.log 2>&1 &" | ||
# 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 | ||
# echo "report_name=$report_name" >> $GITHUB_ENV | ||
|
||
# - name: Run Throughput tests | ||
# run: | | ||
# chmod 755 .ci/perf_tests/run-perftests.sh | ||
# .ci/perf_tests/run-perftests.sh localhost $PORT ${{ env.TESTS_DIR_PATH }} ${{ matrix.test_to_run }} | ||
# echo "Tests completed, terminating py-spy..." | ||
# docker exec $container_id cat /home/site/wwwroot/py-spy.log | ||
# echo "Py-Spy pid is $py_spy_id" | ||
# docker exec $container_id sh -c "kill -2 $py_spy_id" | ||
# sleep 2 | ||
# 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" | ||
# mkdir profiling_reports | ||
# chmod 777 profiling_reports | ||
# docker cp $container_id:/home/profiling_reports/$report_name profiling_reports | ||
# ls -ltr profiling_reports | ||
|
||
- name: Output SVG SAS URL | ||
run: | | ||
echo "You can view the SVG image at: ${{ env.sas_url }}" | ||
# # calculate sas report end time | ||
# current_time=$(date -u '+%Y-%m-%dT%H:%MZ') | ||
# end_time=$(date -u -d "$current_time 30 minutes" '+%Y-%m-%dT%H:%MZ' 2>/dev/null || date -u -D '%Y-%m-%dT%H:%MZ' -d "+30 minutes" '+%Y-%m-%dT%H:%MZ') | ||
# echo "end_time=$end_time" >> $GITHUB_ENV | ||
|
||
# - name: Upload SVG to Azure Blob Storage | ||
# uses: bacongobbler/[email protected] | ||
# with: | ||
# source_dir: 'profiling_reports' # Directory containing the $report_name file | ||
# container_name: 'profiling' | ||
# connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }} | ||
# sync: 'false' | ||
|
||
# - name: Generate Blob SAS URL | ||
# uses: Azure/cli@v1 | ||
# with: | ||
# azcliversion: latest | ||
# inlineScript: | | ||
# sas=$(az storage blob generate-sas \ | ||
# --container-name 'profiling' \ | ||
# --name $report_name \ | ||
# --permissions r \ | ||
# --expiry $end_time \ | ||
# --output tsv \ | ||
# --connection-string ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}) | ||
# url=$(az storage blob url \ | ||
# --container-name 'profiling' \ | ||
# --name $report_name \ | ||
# --output tsv \ | ||
# --connection-string ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}) | ||
# sas_url="$url?$sas" | ||
# echo "SVG SAS URL: $sas_url" | ||
# echo "sas_url=$sas_url" >> $GITHUB_ENV | ||
|
||
# - name: Output SVG SAS URL | ||
# run: | | ||
# echo "You can view the SVG image at: ${{ env.sas_url }}" | ||
|
||
# - name: Upload profiling result to artifact | ||
# uses: actions/upload-artifact@v2 | ||
|