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 request: set ESMF logging mode at run-time via config file #2133

Closed
lizziel opened this issue May 11, 2023 · 11 comments
Closed

Feature request: set ESMF logging mode at run-time via config file #2133

lizziel opened this issue May 11, 2023 · 11 comments
Assignees
Labels
❓ Question Further information is requested

Comments

@lizziel
Copy link
Contributor

lizziel commented May 11, 2023

The ESMF logging mode is currently part of cap_options set via a command line tool. We do not use the command line tool in GCHP and so set the logging mode at a very high level to pass when creating MAPL CAP (see here). To change the logging mode, such as to disable the default ESMF_LOGKIND_MULTI_ON_ERROR, users need to change the code and recompile.

It would be more convenient to set the logging mode at run-time via a config file. This is not possible with the current implementation of MAPL, however, because the logging mode is needed for ESMF initialization (see here) but ESMF initialization needs to happen prior to reading a config file.

The solution to this problem is to pass a config file rather than logging string to ESMF_Initialize. This is possible according to the ESMF docs.

@mathomp4 mathomp4 added the ❓ Question Further information is requested label May 12, 2023
@mathomp4
Copy link
Member

@lizziel I'm assigning @tclune and @bena-nasa to answer this more. They'd have the knowledge on how and if this could be done.

@lizziel
Copy link
Contributor Author

lizziel commented May 12, 2023

Thanks @mathomp4. I should give credit to @tclune (or was it @bena-nasa?) for coming up with the idea to pass a config file to ESMF_Initialize. We discussed solutions at our MAPL meeting earlier this week so they knew this feature request was coming.

@bena-nasa
Copy link
Collaborator

bena-nasa commented May 12, 2023

@lizziel so you want to parse from something the user can configure? YAML? Plain ASCII? ESMF_Config( which of course you can't parse with ESMF_Config at that point)? before that call where you set the logging mode in CapOptions?

@lizziel
Copy link
Contributor Author

lizziel commented May 15, 2023

Hi @bena-nasa, I would like to have a switch in any of the existing rc files. CAP.rc probably make the most sense since it could replace passing the field from CapOptions.

@mathomp4
Copy link
Member

Ben is out today, but I have some time because the work I was doing at NAS needs sysadmin help. So I took a shot at this. I have a branch called feature/mathomp4/2133-pre-esmf-file (see changes here) where you can have a file named ESMF.rc that looks like:

$ cat ESMF.rc
logKindFlag: ESMF_LOGKIND_MULTI_ON_ERROR

and if it's present, it will read it and change the log level.

Now, in this branch (at least) the file MUST be named ESMF.rc because, well, I couldn't figure anything else out. (Since CAP.rc is parsed by ESMF, you can't put anything in there.)

@lizziel Can you try this branch and see how it works for you? If nothing else, it's a first go at this. We will probably wait for @bena-nasa to return and figure out something more elegant and permanent, but we can at least see if this works for you.

@lizziel
Copy link
Contributor Author

lizziel commented May 15, 2023

Thanks @mathomp4. To be clear, this update is not urgent and something that I'd like in a future release that will eventually go into GCHP. I actually have zero time to test unfortunately. At the meeting earlier this week Tom and I agreed on CAP.rc as the place to put the toggle.

@mathomp4
Copy link
Member

Ah okay. Well, it was a fun bit of ESMF learning. 😄

@stale
Copy link

stale bot commented Jul 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. If there are no updates within 7 days, it will be closed. You can add the "long term" tag to prevent the Stale bot from closing this issue.

@stale stale bot added the ❄️ Stale This issue has been marked stale label Jul 16, 2023
@mathomp4
Copy link
Member

@lizziel was this "resolved"?

@lizziel
Copy link
Contributor Author

lizziel commented Jul 17, 2023

I'll know very soon. I am testing your updates today.

@stale stale bot removed the ❄️ Stale This issue has been marked stale label Jul 17, 2023
@lizziel
Copy link
Contributor Author

lizziel commented Jul 17, 2023

This works! I'll put it into GCHP (and give you full credit). If you could merge it into MAPL before the 3 release that would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ Question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants