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

Fix the --loglevel flag #114

Merged
merged 10 commits into from
Dec 21, 2023
Merged

Fix the --loglevel flag #114

merged 10 commits into from
Dec 21, 2023

Conversation

hagertnl
Copy link
Contributor

Currently, the --loglevel flag does not affect verbosity on the command line/stdout. I would like to change that so that it does affect verbosity on the command line.

@hagertnl
Copy link
Contributor Author

A quick note on the logging module and the log levels:
The logger_threshold_level filters all log messages before they ever reach the file or console handlers.
So if you set logger_threshold_level to WARNING, then the file handler will only receive messages >= WARNING.
Then the fh_threshold_level and ch_threshold_level decide what level of messages to send to the file and console, respectively.

Major changes:

  • Added a --loglevel flag to test_harness_driver.py
  • Changed the --loglevel functionality so that instead of --loglevel changing the logger_threshold_level, it only changes the console log level.
    • the filehandler (log file) is hard-coded to INFO, and the logger_threshold_level is either set to NOTSET or DEBUG.

@hagertnl
Copy link
Contributor Author

Tested, and I think that this PR will need to also include a re-assigning of log levels to messages. There are some messages that aren't assigned proper priority. For example, here is the loglevel set to CRITICAL:

> runtests.py -i rgt.input.unittests --mode start stop --loglevel CRITICAL
Using machine config: crusher.ini
Using machine config: crusher.ini
Overriding tasks in inputfile since CLI mode was provided
runmodecmd =  ['start', 'stop']
self.__harness_task:  [['start_tests', None, None]]
self.__harness_task:  [['start_tests', None, None], ['stop_tests', None, None]]
reading harness config /lustre/orion/proj-shared/stf016/hagertnl/Scratch/harness-dev/olcf-test-harness/configs/crusher.ini
RGT_PATH_TO_SSPACE is already set. Skipping.
Starting tasks for Application.Test: harness_unit_tests.test_successful_run: [['start_tests', None, None], ['stop_tests', None, None]]
Using machine config: crusher.ini
reading harness config /lustre/orion/proj-shared/stf016/hagertnl/Scratch/harness-dev/olcf-test-harness/configs/crusher.ini
RGT_MACHINE_NAME is already set. Skipping.
RGT_MACHINE_TYPE is already set. Skipping.
RGT_SCHEDULER_TYPE is already set. Skipping.
RGT_JOBLAUNCHER_TYPE is already set. Skipping.
RGT_CPUS_PER_NODE is already set. Skipping.
RGT_GPUS_PER_NODE is already set. Skipping.
RGT_SUBMIT_QUEUE is already set. Skipping.
RGT_SUBMIT_ARGS is already set. Skipping.
RGT_NCCS_TEST_HARNESS_MODULE is already set. Skipping.
RGT_TYPE_OF_REPOSITORY is already set. Skipping.
RGT_GIT_REPS_BRANCH is already set. Skipping.
RGT_GIT_DATA_TRANSFER_PROTOCOL is already set. Skipping.
RGT_GIT_MACHINE_NAME is already set. Skipping.
RGT_GIT_SERVER_APPLICATION_PARENT_DIR is already set. Skipping.
RGT_GIT_SSH_SERVER_URL is already set. Skipping.
RGT_GIT_HTTPS_SERVER_URL is already set. Skipping.
RGT_PATH_TO_SSPACE is already set. Skipping.
RGT_SYSTEM_LOG_TAG is already set. Skipping.
RGT_ACCT_ID is already set. Skipping.
Using launch id: crusher_test/hagertnl@2023-05-12T09:18:56.59
Generated test unique id: 1683897536.7776563
In test_harness_driver, creating logger with logger_name=__main__, fh_filepath=/autofs/nccs-svm1_proj/stf016/hagertnl/harness/unit_tests/harness_unit_tests/test_successful_run/Run_Archive/1683897536.7776563/LogFiles/application_logfile.txt
Creating machine crusher: Type = linux_x86_64 ; Scheduler = slurm ; Job launcher = srun
Creating scheduler
Creating jobLauncher
RGT Test Parameters - Builtin
=============================
job_name = test_successful_run
nodes = 1
total_processes = 1
batch_queue = batch
walltime = 1
executable_path = ./dummy
batch_filename = run.sh
build_cmd = ./build_success.sh
check_cmd = ./check.sh
report_cmd = ./report.sh
resubmit = 1
RGT Test Parameters - User
==========================
Path to Source: /autofs/nccs-svm1_proj/stf016/hagertnl/harness/unit_tests/harness_unit_tests/Source
Path to Build Dir: /lustre/orion/proj-shared/stf016/hagertnl/harness_sspace/crusher/04.27.23-16.26/harness_unit_tests/test_successful_run/1683897536.7776563/build_directory
WARNING: Ignoring invalid built-in parameter key launch_id
Submitting job from SLURM class using batchfilename run.sh
sbatch  -p batch  -A stf016 run.sh
SLURM jobID =  313792
build exit value = 0
submit exit value = 0
Skipped 0, launched 1.

@hagertnl
Copy link
Contributor Author

After the most recent updates, below is what we see when using CRITICAL log threshold. One note. The build exit value and submit exit value lines typically at the bottom of the output are no longer there, because I added them as INFO logging threshold, instead of print(). To my knowledge, there's not a logger threshold that is "critical info" - info that should be printed every time. Should I use the CRITICAL threshold for this?

> runtests.py -i rgt.input.unittests --mode start stop --loglevel CRITICAL
Using machine config: crusher.ini
Using machine config: crusher.ini
Overriding tasks in inputfile since CLI mode was provided
runmodecmd =  ['start', 'stop']
self.__harness_task:  [['start_tests', None, None]]
self.__harness_task:  [['start_tests', None, None], ['stop_tests', None, None]]
reading harness config /lustre/orion/proj-shared/stf016/hagertnl/Scratch/harness-dev/olcf-test-harness-fork/configs/crusher.ini
RGT_PATH_TO_SSPACE is already set. Skipping.
Starting tasks for Application.Test: harness_unit_tests.test_successful_run: [['start_tests', None, None], ['stop_tests', None, None]]
Using machine config: crusher.ini
reading harness config /lustre/orion/proj-shared/stf016/hagertnl/Scratch/harness-dev/olcf-test-harness-fork/configs/crusher.ini
RGT_MACHINE_NAME is already set. Skipping.
RGT_MACHINE_TYPE is already set. Skipping.
RGT_SCHEDULER_TYPE is already set. Skipping.
RGT_JOBLAUNCHER_TYPE is already set. Skipping.
RGT_CPUS_PER_NODE is already set. Skipping.
RGT_GPUS_PER_NODE is already set. Skipping.
RGT_SUBMIT_QUEUE is already set. Skipping.
RGT_SUBMIT_ARGS is already set. Skipping.
RGT_NCCS_TEST_HARNESS_MODULE is already set. Skipping.
RGT_TYPE_OF_REPOSITORY is already set. Skipping.
RGT_GIT_REPS_BRANCH is already set. Skipping.
RGT_GIT_DATA_TRANSFER_PROTOCOL is already set. Skipping.
RGT_GIT_MACHINE_NAME is already set. Skipping.
RGT_GIT_SERVER_APPLICATION_PARENT_DIR is already set. Skipping.
RGT_GIT_SSH_SERVER_URL is already set. Skipping.
RGT_GIT_HTTPS_SERVER_URL is already set. Skipping.
RGT_PATH_TO_SSPACE is already set. Skipping.
RGT_SYSTEM_LOG_TAG is already set. Skipping.
RGT_ACCT_ID is already set. Skipping.
Using launch id: crusher_test/hagertnl@2023-08-29T09:54:13.79
Generated test unique id: 1693317253.9446626
Creating machine crusher: Type = linux_x86_64 ; Scheduler = slurm ; Job launcher = srun
Creating scheduler
Creating jobLauncher
RGT Test Parameters - Builtin
=============================
job_name = test_successful_run
nodes = 1
total_processes = 1
batch_queue = batch
walltime = 1
executable_path = ./dummy
batch_filename = run.sh
build_cmd = ./build_success.sh
check_cmd = ./check.sh
report_cmd = ./report.sh
resubmit = 1
RGT Test Parameters - User
==========================
WARNING: Ignoring invalid built-in parameter key launch_id
Submitting job from SLURM class using batchfilename run.sh
sbatch  -p batch  -A stf016 run.sh
SLURM jobID =  366639
Launched 1 tests, skipped 0 tests.

@hagertnl
Copy link
Contributor Author

Most of the output currently is from files without loggers, which I identified in #130

@hagertnl hagertnl marked this pull request as ready for review August 29, 2023 14:41
@hagertnl hagertnl mentioned this pull request Aug 29, 2023
Copy link
Contributor

@ddietz89 ddietz89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, other than the one question.

@ddietz89 ddietz89 merged commit 9acbe49 into devel Dec 21, 2023
@hagertnl hagertnl deleted the nick-fix-log-level branch May 9, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants