-
Notifications
You must be signed in to change notification settings - Fork 24
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 dtcenter/METplus-Internal#19 log user ID and dtcenter/METplus-Internal#21 signal handling #2160
Conversation
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.
These changes look like a good approach to adding the desired information to the run of each MET tool. The changes needed for each other tool would be minimal with this approach. I made a few suggested edits inline. There are a few commented lines of code that could be removed as well. I approve.
met/src/basic/vx_log/main.cc
Outdated
|
||
//////////////////////////////////////////////////////////////////////// | ||
|
||
void do_post_preocess(uid_t user_id, const char *tool_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.
void do_post_preocess(uid_t user_id, const char *tool_name) { | |
void do_post_process(uid_t user_id, const char *tool_name) { |
met/src/basic/vx_log/main.cc
Outdated
|
||
int return_code = met_main(argc, argv); | ||
|
||
do_post_preocess(user_id, tool_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.
do_post_preocess(user_id, tool_name); | |
do_post_process(user_id, tool_name); |
met/src/basic/vx_log/main.cc
Outdated
|
||
void do_post_preocess(uid_t user_id, const char *tool_name) { | ||
cout << " Do post-processing\n"; | ||
cout << " Done " << tool_name << " by user " << user_id << " at " << get_current_time() << "\n"; |
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.
Consider changing "Done" to "Finished" or "Completed"
src/basic/vx_log/main.cc
Outdated
|
||
return return_code; | ||
|
||
} |
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.
} | |
} | |
src/basic/vx_log/main.cc
Outdated
// Filename: main.cc | ||
// | ||
// Description: | ||
// The main() should be inplemented here and the exisyting main() should be renamed to met_main. |
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 main() should be inplemented here and the exisyting main() should be renamed to met_main. | |
// The main() should be implemented here and the existing main() | |
// should be renamed to met_main(). | |
// | |
//////////////////////////////////////////////////////////////////////// |
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.
Howard, I get the general idea here, creating a wrapper for the existing main() function of each tool. And it seems like a promising approach. One issue I see is writing the timestamps to cout instead of via the logger. Is there a way to route the messages through mlog instead so that they can be save to the generated log file?
…ternal_19_log_user_id
…ternal_19_log_user_id
Typos were corrected.
To do list:
|
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.
@hsoh-u there is a single main() function you missed updating:
src/tools/other/wwmca_tool/wwmca_regrid.cc:int main(int argc, char * argv [])
After updating that one, please proceed with the merge.
I see via GHA that the code still compiles and produces no unexpected diffs.
We should include this change in the beta2 release tomorrow so that we have plenty of time to test it out and make sure it doesn't cause any unintended compilation/runtime consequences.
I approve, subject to updating wwmca_regrid.cc.
Thanks for all your detailed work on this!
Note that this issue also resolved dtcenter/METplus-Internal#18 since it logs the beginning/ending time of each run. |
Expected Differences
This is a prototype for the design review for login user ID and adding signal handlers at the centralized location. Note: only ascii2nc was modified to demonstrate the design.
Common implementation at main.h & main.cc
each MET tools (for example, ascii2nc)
exit() should be modified to call the post_processing or should create a custom signal
Do these changes introduce new tools, command line arguments, or configuration file options? [Yes or No]
If yes, please describe:
Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [Yes or No]
If yes, please describe:
Pull Request Testing
[] Describe testing already performed for these changes:
Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:
Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [No]
Do these changes include sufficient testing updates? [No]
Will this PR result in changes to the test suite? [No]
If yes, describe the new output and/or changes to the existing output:
Please complete this pull request review by [Fill in date].
Pull Request Checklist
See the METplus Workflow for details.
Select: Reviewer(s)
Select: Organization level software support Project or Repository level development cycle Project
Select: Milestone as the version that will include these changes