-
Notifications
You must be signed in to change notification settings - Fork 11
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
Standardizing Logging Level Strings, Fixed do_kafka_test.sh
script
#31
Conversation
…petitive behavior.
…to the `standalone.sh` script.
…time to be ready.
…ut to the kafka-topics.sh script.
…topic creation check.
… PPM logs is above 100 instead of waiting a fixed amount of time for PPM readiness.
…`standalone-multi.sh`
…`do_kafka_test.sh`
…script calls in `do_bsm_test.sh` & `do_tim_test.sh`
update logging level strings
Fixed `do_kafka_test.sh` script
do_kafka_test.sh
script
Update Default Logging Level
@@ -19,6 +19,13 @@ | |||
"ms-vscode.cmake-tools" | |||
], | |||
|
|||
"features": { | |||
"docker-from-docker": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which repository does this feature reference to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADD ./docker-test /cvdi-stream/docker-test | ||
|
||
# Run the tool. | ||
RUN chmod 7777 /cvdi-stream/docker-test/ppm_no_map.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this typo "7777"?
ADD ./config /cvdi-stream/config | ||
|
||
# Do the build. | ||
RUN export LD_LIBRARY_PATH=/usr/local/lib && mkdir /cvdi-stream-build && cd /cvdi-stream-build && cmake /cvdi-stream && make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this /cvdi-stream-build folder or a build folder inside /cvdi-stream? like /cvdi-stream/build mkdir -p /cvdi-stream/build && cd /cvdi-stream/build && cmake /cvdi-stream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse the ./devcontainer and replace the Dockerfile.testing with the vscode test task for the testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Project files are stored in /cvdi-stream
and are used to build executables in /cvdi-stream-build
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Dockerfile.testing
file is used by scripts involved in the execution of the do_kafka_test.sh
script, which is an integration test between the PPM & Kafka. The primary difference is that python is included so that the 'test_in.py' and 'test_out.py' scripts are usable.
I don't think this should be replaced by using the dev container, since the dev container is meant for development and the Dockerfile.testing
file is meant for integration testing.
…of passing opt string." This reverts commit fb010fa.
@@ -245,19 +245,19 @@ void PPM::print_configuration() const | |||
bool PPM::configure() { | |||
|
|||
if ( optIsSet('v') ) { | |||
if ( "trace" == optString('v') ) { | |||
if ( "TRACE" == optString('v') ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this log level string case insensitive? I see the configuration doc mentioned
-v | --log-level : The info log level [trace,debug,info,warning,error,critical,off]
They are all lower case. The code only compare the upper case.
docker-compose rm -f -v | ||
docker-compose up --build -d | ||
docker ps | ||
./stop_kafka.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that 'chmod 777' needs to be executed on stop_kafka.sh
prior to using the start_kafka.sh
script here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, adding 777 works for me.
/cvdi-stream-build/kafka-test/kafka_tool -C -b $broker -p 0 -t topic.FilteredOdeBsmJson -e -o $offset 2> con.err | /cvdi-stream/docker-test/test_out.py > tmp.out | ||
attempts=$((attempts+1)) | ||
|
||
timeout 5 /cvdi-stream-build/kafka-test/kafka_tool -C -b $broker -p 0 -t topic.FilteredOdeBsmJson -e -o $offset 2> con.err | /cvdi-stream/docker-test/test_out.py > tmp.out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The do_bsm_test.sh
script isn't intended to be run directly. I believe it is used by the standalone.sh
and standalone_multi.sh
scripts, which are in turn used by the do_kafka_test.sh
script. Do you experience this behavior when running the do_kafka_test.sh
script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to finish running the do_kafka_test.sh as some data are missing below (or I do not have those data in my ubuntu):
/ppm_data/road_file.csv
/tmp/docker-test/data
|
||
CURRENT_DIR_NAME=${PWD##*/} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test Scenario 1:
I started Zookeeper and Kafka container first, then run this do_kafka_test.sh script. This script is going to start kafka again in the setup() func, and waitForKafkaToCreateTopics() complain that Kafka is not up.
Test Scenario 2:
Stop Kafka and zookeeper. Run the do_kafka_test.sh script.
IT will start the containers and then stop them at step 2. Should we remove the stop_kafka.sh from the start_kafka.sh script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Zookeeper and Kafka are already running, the do_kafka_test.sh
script should restart them prior to building the PPM image and running the tests.
If Zookeeper and Kafka are not running, the do_kafka_test.sh
script should start them.
Another comment of yours mentions that the kafka container name uses an underscore, not a hyphen. It's possible that this is why the container is not being found in Step 2. Interestingly, when I run the script the container name uses a hyphen, not an underscore. I wonder if this could be due to differences in docker versions. I am using Docker Desktop 4.17.0, what are you using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using ubuntu 18.04 and docker version 20.10.6
# print setup info | ||
echo "=== Setup Info ===" | ||
echo "DOCKER_HOST_IP: $DOCKER_HOST_IP" | ||
echo "KAFKA_CONTAINER_NAME: $KAFKA_CONTAINER_NAME" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my machine, the kafka container name is separated by a hyphen. This may have to do with differences in Docker Desktop versions. I am using v4.17.0, what are you using?
We may want to consider modifying the script to check for container names separated by an underscore and a hyphen, just to cover all of our bases.
fi | ||
done | ||
echo "Starting PPM in new container '$PPM_CONTAINER_NAME'" | ||
docker run --name $PPM_CONTAINER_NAME --env DOCKER_HOST_IP=$dockerHostIp --env PPM_LOG_TO_CONSOLE=true --env PPM_LOG_TO_FILE=true -v /tmp/docker-test/data:/ppm_data -d -p '8080:8080' $PPM_IMAGE_NAME:$PPM_IMAGE_TAG /cvdi-stream/docker-test/ppm_standalone.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the standalone.sh
script in intended to run inside of a freshly-spun-up docker container, I believe using an absolute path here is the way to go.
The reason that you are experiencing stalling is because the script is expecting the container to have a number of logs before it is deemed 'ready'. Recently, we switched the default logging level to ERROR instead of TRACE, so the container is not spitting out any logs. This should be resolved by CDOT-CV#36. It should be noted that CDOT#36 is not merged into develop yet, so I suggest trying this again once it has been merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense as /cvdi-stream is inside container. Would like to clarify that I am not referring to /cvdi-stream/. I am running the standalone.sh inside my ubuntu, and I do not have this /tmp/docker-test/data directory. I am wandering if we could reuse the data directory in this repository.
if [ $4 = "BSM" ]; then | ||
docker exec ppm_kafka /cvdi-stream/docker-test/do_bsm_test.sh $OFFSET | ||
# Produce the test data. | ||
docker exec $PPM_CONTAINER_NAME /cvdi-stream/docker-test/do_bsm_test.sh $OFFSET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here. It might be helpful to use relative path rather than absolute path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the command is intended to run inside of a docker container, an absolute path should be a fine method for referencing the script. I don't think this is a problem.
Logging Level Strings
The logging level strings have been made uppercase to align with the logging level strings used in the other submodules.
Fixed
do_kafka_test.sh
ScriptThe
do_kafka_test.sh
was created six years ago, but it was discovered last year that it was not functioning properly due to inconsistencies in container name references and issues with dependent scripts.The script has been refactored and thoroughly tested to ensure its functionality when executed in WSL.
Additional Changes
do_kafka_test.sh
do_kafka_test.sh
,do_bsm_test.sh
anddo_tim_test.sh
scripts.standalone.sh
andstandalone-multi.sh
scripts have been refactored.do_kafka_test.sh
script to run.docker-compose-kafka.yml
file has been added for testing purposes.Testing
These changes have been verified to be working when the script is run locally in WSL.