Conversation
mkundu1
left a comment
There was a problem hiding this comment.
I think logging into a single file by default is a better idea as the order of the operations can easily be understood by looking into a single file.
|
The changes exposed what I believe is a flaw in ansys/actions ansys/actions#269, causing all of the tests that use Fixed some of the tests related to the broken github actions from PyFluent's side. For the ansys/actions side, the best way to fix this in the long term is going to require changes on their repo which I currently don't have permissions to create branches/PRs, so I just created the issue tracker for now |
|
Left an useful debug args for docker run commented here, may be useful in the future for others as well, let me know if you prefer that I remove it: pyfluent/src/ansys/fluent/core/launcher/fluent_container.py Lines 62 to 63 in c67798c |
Closes #1259, #1625, #1532 and I believe also #9 (see discussion below)
Changes:
pyfluentprefix to avoid conflict with other loggersLogging file example
PYFLUENT_LOGGINGenvironment variable, which we can use so that we don't have to change logging levels manually and so that logging is automatically set toDEBUG(or any other level you want) for development/debugginglist_loggers()andset_global_level()(see documentation in the item below)User guide index
API reference index
(this isn't directly related to Fluent's API, but couldn't think of a better place in the current docs, please let me know of any suggestions)Recommendations:
loggingcalls such aslogging.info()orlogging.warning()is something we should avoid and could conflict/cause issues with other packages or something that users have set up themselves, using the custom defined loggers is better in every way that I can think of, sologger=getLogger('pyfluent...'); logger.info()etcprint()when the objective is to output non-error information to the Python console directly for the user to see or when it is an important non-error message and just logging to files is insufficient (we can set up additional logging for different combinations as well if necessary)In regards to #9, the only scenario where no useful information or silent failing was being returned to the user that I could think of, and based on my experience as this was an issue for me too, was when running Fluent on containers, where it was failing completely silently with no logs or console output at all to help. My suggested fix (relevant lines below) is to set the docker image to run on the specified work directory that is also mounted on the container host system. In this way, the user, which has access to the host system but not necessarily the guest docker container files, now has access to the Fluent automatic transcript output too, which is typically what is needed to better debug launch issues. I have also changed all the docker run shorthand args for their full names (check the other lines around the ones linked below), as I believe this makes them much clearer and easier to work with. Please let me know if I missed any scenarios where logging and workdir/transcript location changes aren't sufficient.
pyfluent/src/ansys/fluent/core/launcher/fluent_container.py
Lines 60 to 61 in c67798c
While this is fresh on my mind, please let me know if you have any questions, can think of any suggestions or ways in which logging would be more useful to you for development or any other purposes.