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

Feature/276 new script file for testing framework #238

Draft
wants to merge 36 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d2d27d3
276 Add new script, fixes to some bugs found and changes to current s…
rolandoquesada Oct 22, 2024
2f019df
276 Apply format in Python files
rolandoquesada Oct 22, 2024
7feb16d
276 Fix compilation error when merging the file
rolandoquesada Oct 22, 2024
9472fff
Merge branch 'feature/276_new_script_file_for_testing_01' of https://…
rolandoquesada Oct 22, 2024
88dde27
276 Update some tests and run_all_tests.py file
rolandoquesada Oct 23, 2024
6681c88
276 Fix code scanning alert no. 18
rolandoquesada Oct 23, 2024
559b9e1
276 Fix code scanning alert
rolandoquesada Oct 23, 2024
ac1fa70
276 Enabled the option of printing out the log files generated by the…
rolandoquesada Oct 24, 2024
a7c293e
276 Attempt to print out the logs created by the testing process
rolandoquesada Oct 25, 2024
fa3d680
276 Another attempt to print out the contents of the logs
rolandoquesada Oct 25, 2024
0269c4d
Merge branch 'develop' into feature/276_new_script_file_for_testing_01
rolandoquesada Oct 25, 2024
03d1c72
Update CI.yml
michaelbeale-IL Oct 25, 2024
c5fe9d4
Merge pull request #242 from IntelLabs/CI-Fix
michaelbeale-IL Oct 25, 2024
b75e2e6
276 Add one new line just to trigger the CI/CD process
rolandoquesada Oct 25, 2024
c8fb9b7
Merge branch 'develop' into feature/276_new_script_file_for_testing_01
rolandoquesada Oct 30, 2024
d1c8429
276 Attempt to print out the logs in case of any errors
rolandoquesada Oct 31, 2024
4e49638
276 Add new step in the _CI_coverage.yml file
rolandoquesada Oct 31, 2024
199c599
276 Attempt to print the logs of the testing
rolandoquesada Nov 1, 2024
548ac77
276 Display the python version
rolandoquesada Nov 1, 2024
98bf2f8
276 Add import skvideo.io to the function files
rolandoquesada Nov 2, 2024
a9646dc
Merge branch 'develop' into feature/276_new_script_file_for_testing_01
rolandoquesada Nov 4, 2024
5a3b0ee
276 Attempt to reload the skvideo module during the testing
rolandoquesada Nov 4, 2024
0f5e7f5
276 Reload the cv2 library for fixing issue during the testing
rolandoquesada Nov 5, 2024
db987b5
276 Python 3.12 version used in the run_all_tests.py file
rolandoquesada Nov 5, 2024
7060ffb
276 Attempt to fix the issue related to the mp4 encoder missing
rolandoquesada Nov 6, 2024
876878f
276 Show error message in QueryHandler.CustomFunctionNoProcess test
rolandoquesada Nov 7, 2024
8e00db8
276 Remove QueryHandler.CustomFunctionNoProcess test
rolandoquesada Nov 13, 2024
263d2d5
Merge branch 'develop' into feature/276_new_script_file_for_testing_01
rolandoquesada Nov 13, 2024
a752da1
276 Fix run_all_tests.py file to retrieve the coverage for the Python…
rolandoquesada Nov 14, 2024
c203d72
Automated updates: Format and/or coverage
sys-vdms Nov 14, 2024
3b41e70
276 Bring back the execution of the E2E tests for Neo4J
rolandoquesada Nov 14, 2024
fca8990
Merge branch 'feature/276_new_script_file_for_testing_01' of https://…
rolandoquesada Nov 14, 2024
f0f329c
276 Fix a compilation error due to a missing include in utils.h file
rolandoquesada Nov 14, 2024
dee7103
Automated updates: Format and/or coverage
sys-vdms Nov 14, 2024
b2b01c6
276 Remove any calls to CustomVCL class
rolandoquesada Nov 21, 2024
82af33d
Automated updates: Format and/or coverage
sys-vdms Nov 21, 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
31 changes: 15 additions & 16 deletions .github/coverage/cpp.develop.coverage_report.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/coverage/cpp.develop.coverage_value.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
64.1609
63.9352
17 changes: 9 additions & 8 deletions .github/scripts/run_coverage_cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

cd /vdms/tests

# Run Local C++ PMGD Based Tests
chmod +x run_tests.sh
echo 'Running run_tests.sh script'
./run_tests.sh

# Run S3 C++ PMGD Based Tests
echo 'Checking for the available disk space due MinIO requires at least 1gb free'
df -h
chmod +x run_aws_tests.sh
echo 'Running run_aws_tests.sh script'
./run_aws_tests.sh -u ${AWS_ACCESS_KEY_ID} -p ${AWS_SECRET_ACCESS_KEY}

chmod +x ./run_all_tests.py

echo 'Running run_all_tests.py script for remote C++ tests (-t=ru)'
python ./run_all_tests.py -t=ru -k -u ${AWS_ACCESS_KEY_ID} -p ${AWS_SECRET_ACCESS_KEY}

echo 'Running run_all_tests script for C++ tests (-t=ut)'
python ./run_all_tests.py -t=ut -k

echo 'Getting the coverage for C++'
# Obtain Coverage
gcovr --root /vdms \
-e /vdms/src/pmgd -e /vdms/build -e /vdms/distributed -e /vdms/tests \
Expand Down
27 changes: 22 additions & 5 deletions .github/scripts/run_coverage_py.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#!/bin/bash -e

cd /vdms/tests/python
cd /vdms/tests
chmod +x ./run_all_tests.py
chmod +x ./TestScript.py

./run_python_tests.sh
./run_python_aws_tests.sh -u ${AWS_ACCESS_KEY_ID} -p ${AWS_SECRET_ACCESS_KEY}
python -m coverage report -m 2>&1 | tee /vdms/tests/coverage_report/python.new.coverage_report.txt
python -m coverage xml -o /vdms/tests/coverage_report/python.new.coverage_report.xml
# Check .coverage file doesn't exist
if [ -f './.coverage' ]; then
echo ".coverage exists."
rm ./.coverage
echo ".coverage deleted."
fi

echo 'Running run_all_tests script for Python tests (-t=pt)'
python3 ./run_all_tests.py -t=pt -k

echo 'Running run_all_tests script for Remote Python tests (-t=rp)'
python3 ./run_all_tests.py -t=rp -k -u=${AWS_ACCESS_KEY_ID} -p=${AWS_SECRET_ACCESS_KEY}

echo 'Running the tests included in TestScript.py file'
# Append the coverage results to the ones obtained from running run_all_tests.py
python3 -m coverage run -a --omit="./run_all_tests.py,./TestScript.py" -m unittest discover --pattern=TestScript.py -v

python3 -m coverage report -m 2>&1 | tee /vdms/tests/coverage_report/python.new.coverage_report.txt
python3 -m coverage xml -o /vdms/tests/coverage_report/python.new.coverage_report.xml

echo "DONE"

Expand Down
52 changes: 44 additions & 8 deletions .github/workflows/_CI_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ jobs:
echo "VDMS_TAG=${VDMS_TAG_STR}" >> $GITHUB_OUTPUT

# Commands for neo4j tests
COMMON_ARGS="-n ${{ secrets.NEO4J_USER }} -w ${{ secrets.NEO4J_PASS }} -v ${{ env.NEO_TEST_PORT}}"
S3_ARGS="-a ${{ env.AWS_API_PORT }} -c ${{ env.AWS_CONSOLE_PORT}} -u ${{ secrets.AWS_ACCESS_KEY_ID }} -p ${{ secrets.AWS_SECRET_ACCESS_KEY }}"
COMMON_ARGS="--neo4j_username ${{ secrets.NEO4J_USER }} --neo4j_password ${{ secrets.NEO4J_PASS }} --neo4j_port ${{ env.NEO_TEST_PORT }}"
S3_ARGS="--minio_port ${{ env.AWS_API_PORT }} --minio_console_port ${{ env.AWS_CONSOLE_PORT }} -u ${{ secrets.AWS_ACCESS_KEY_ID }} -p ${{ secrets.AWS_SECRET_ACCESS_KEY }}"

CMD_STR_e2e_str="./run_neo4j_tests.sh -t Neo4JE2ETest ${S3_ARGS} ${COMMON_ARGS} -e neo4j://neo4j:${{ env.NEO_TEST_PORT}}"
CMD_STR_e2e_str="./run_all_tests.py --type_of_test neo --test_name 'Neo4JE2ETest.*' ${S3_ARGS} ${COMMON_ARGS} --neo4j_endpoint neo4j://neo4j:${{ env.NEO_TEST_PORT}}"
echo "CMD_STR_e2e=${CMD_STR_e2e_str}" >> $GITHUB_OUTPUT

CMD_STR_OpsIO_str="./run_neo4j_tests.sh -t OpsIOCoordinatorTest ${S3_ARGS} ${COMMON_ARGS} -e neo4j://neo4j:${{ env.NEO_TEST_PORT}}"
CMD_STR_OpsIO_str="./run_all_tests.py --type_of_test neo --test_name 'OpsIOCoordinatorTest.*' ${S3_ARGS} ${COMMON_ARGS} --neo4j_endpoint neo4j://neo4j:${{ env.NEO_TEST_PORT }}"
echo "CMD_STR_OpsIO=${CMD_STR_OpsIO_str}" >> $GITHUB_OUTPUT

CMD_STR_bkend_str="./run_neo4j_tests.sh -t Neo4jBackendTest ${COMMON_ARGS} -e neo4j://neo4j:${{ env.NEO_TEST_PORT}}"
CMD_STR_bkend_str="./run_all_tests.py --type_of_test neo --test_name 'Neo4jBackendTest.*' ${COMMON_ARGS} --neo4j_endpoint neo4j://neo4j:${{ env.NEO_TEST_PORT }}"
echo "CMD_STR_bkend=${CMD_STR_bkend_str}" >> $GITHUB_OUTPUT

- name: Run Neo4J Tests
Expand All @@ -183,7 +183,7 @@ jobs:

# E2E Test
echo "${{ env.CMD_STR_e2e }}"
docker exec -w /vdms/tests ${{ env.SOURCE_CONTAINER_NAME }} bash -c "${{ env.CMD_STR_e2e }}"
docker exec -w /vdms/tests ${{ env.SOURCE_CONTAINER_NAME }} bash -c "python ${{ env.CMD_STR_e2e }}"
docker kill ${{ env.NEO4J_CONTAINER_NAME }} || true
sleep 15

Expand All @@ -203,7 +203,7 @@ jobs:

# Ops IO Test
echo "${{ env.CMD_STR_OpsIO }}"
docker exec -w /vdms/tests ${{ env.SOURCE_CONTAINER_NAME }} bash -c "${{ env.CMD_STR_OpsIO }}"
docker exec -w /vdms/tests ${{ env.SOURCE_CONTAINER_NAME }} bash -c "python ${{ env.CMD_STR_OpsIO }}"
docker kill ${{ env.NEO4J_CONTAINER_NAME }} || true
sleep 15

Expand All @@ -226,7 +226,43 @@ jobs:
docker cp ${{ env.SOURCE_CONTAINER_NAME }}:/vdms/tests/coverage_report/python.new.coverage_value.txt ${GITHUB_WORKSPACE}/.github/coverage/python.new.coverage_value.txt || true
echo "coverage_value_py=$(cat ${GITHUB_WORKSPACE}/.github/coverage/python.new.coverage_value.txt)" >> $GITHUB_ENV
echo "pr_dev_value_py=$(cat ${GITHUB_WORKSPACE}/.github/coverage/python.old-develop.coverage_value.txt)" >> $GITHUB_ENV

- name: Print out the logs
shell: bash
id: print_out_logs
if: ${{ always() }}
run: |
echo "print pip version"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} pip -V || true
echo "Python version"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} python --version || true
echo "Python3 version"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} python3 --version || true
echo "Print out the logs"
echo "tests_stderr_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/tests_stderr_log.log || true
echo "tests_stdout_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/tests_stdout_log.log || true
echo "tls_stderr_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/tls_stderr_log.log || true
echo "tls_stdout_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/tls_stdout_log.log || true
echo "udf_local_stderr_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/udf_local_stderr_log.log || true
echo "udf_local_stdout_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/udf_local_stdout_log.log || true
echo "udf_server_stderr_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/udf_server_stderr_log.log || true
echo "udf_server_stdout_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/udf_server_stdout_log.log || true
echo "vdms_stderr_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/vdms_stderr_log.log || true
echo "vdms_stdout_log:"
docker exec ${{ env.SOURCE_CONTAINER_NAME }} cat /vdms/tests/tests_output_dir/vdms_stdout_log.log || true
echo "End of Print out the logs..."
- name: Docker Compose down
shell: bash
id: docker_compose_down
run: |
# Stops containers and removes containers, networks, volumes, and images
cd ${GITHUB_WORKSPACE}/.github/scripts
docker compose down
Expand Down
37 changes: 0 additions & 37 deletions include/vcl/CustomVCL.h

This file was deleted.

4 changes: 3 additions & 1 deletion include/vcl/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* The MIT License
*
* @copyright Copyright (c) 2017 Intel Corporation
* @copyright Copyright (c) 2024 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -29,6 +29,8 @@

#pragma once

#include <cstdint>
#include <string>
#include <time.h>
#include <vector>

Expand Down
44 changes: 30 additions & 14 deletions remote_function/functions/caption.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
import cv2
import numpy as np
from datetime import datetime
from collections import deque
import skvideo.io
import imutils
import uuid
import os
import sys

DEBUG_MODE = True

def run(ipfilename, format, options):
opfilename = "tmpfile" + uuid.uuid1().hex + "." + str(format)
print(opfilename)

def run(ipfilename, format, options, tmp_dir_path, functions_path):
if DEBUG_MODE:
print("Temporary path:", tmp_dir_path, file=sys.stderr)
print("Functions path:", functions_path, file=sys.stderr)
print("options:", options, file=sys.stderr)
print("format:", format, file=sys.stderr)
print("ipfilename", ipfilename, file=sys.stderr)
opfilename = os.path.join(
tmp_dir_path, "tmpfile" + uuid.uuid1().hex + "." + str(format)
)
if DEBUG_MODE:
print("opfilename:", opfilename, file=sys.stderr)
vs = cv2.VideoCapture(ipfilename)
frame_width = int(vs.get(3))
frame_height = int(vs.get(4))

video = cv2.VideoWriter(
opfilename, cv2.VideoWriter_fourcc(*"XVID"), 30, (frame_width, frame_height)
)
# video = skvideo.io.FFmpegWriter(opfilename, {"-pix_fmt": "bgr24"})
if DEBUG_MODE:
print(options, file=sys.stderr)

video = skvideo.io.FFmpegWriter(opfilename, {"-pix_fmt": "bgr24"})
print(options)
i = 0
while True:
(grabbed, frame) = vs.read()
if not grabbed:
print("[INFO] no frame read from stream - exiting")
video.close()
# video.close()
# sys.exit(0)
break

Expand All @@ -28,6 +42,8 @@ def run(ipfilename, format, options):
frame, label, (10, 25), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (255, 255, 255), 2
)

video.writeFrame(frame)
# video.writeFrame(frame)
video.write(frame)
video.release()

return opfilename
return opfilename, None
40 changes: 32 additions & 8 deletions remote_function/functions/facedetect.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
import cv2
import os
import sys

face_cascade = cv2.CascadeClassifier(
# This file is available from OpenCV 'data' directory at
# https://github.com/opencv/opencv/blob/4.x/data/haarcascades/haarcascade_frontalface_default.xml
"functions/files/haarcascade_frontalface_default.xml"
)
DEBUG_MODE = True


def run(ipfilename, format, options):
global face_cascade
def run(ipfilename, format, options, tmp_dir_path, functions_path):
if DEBUG_MODE:
print("Temporary path:", tmp_dir_path, file=sys.stderr)
print("Functions path:", functions_path, file=sys.stderr)
print("options:", options, file=sys.stderr)
print("format:", format, file=sys.stderr)
print("ipfilename", ipfilename, file=sys.stderr)

haarcascade_frontalface_default_path = os.path.join(
functions_path, "files/haarcascade_frontalface_default.xml"
)

if not os.path.exists(haarcascade_frontalface_default_path):
raise Exception(f"{haarcascade_frontalface_default_path}: path is invalid")

face_cascade = cv2.CascadeClassifier(
# This file is available from OpenCV 'data' directory at
# https://github.com/opencv/opencv/blob/4.x/data/haarcascades/haarcascade_frontalface_default.xml
# "functions/files/haarcascade_frontalface_default.xml"
haarcascade_frontalface_default_path
)

if DEBUG_MODE:
print("Facedetect: ipfilename", ipfilename)
if not os.path.exists(ipfilename):
raise Exception(
f"Facedetect error: File ipfilename: {ipfilename} does not exist"
)

img = cv2.imread(ipfilename)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Expand All @@ -17,4 +41,4 @@ def run(ipfilename, format, options):
for x, y, w, h in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)

return img
return img, None
Loading
Loading