Skip to content

Include MPI process rank in exception log messages #601

@yousefmoazzam

Description

@yousefmoazzam

Currently, the exception-logging function only logs the message:

httomo/httomo/utils.py

Lines 76 to 85 in 8ccf663

def log_exception(output: str) -> None:
"""
Log an exception to the log file.
Parameters
----------
output : str
The exception to be logged.
"""
logger.error(output)

but adding in the rank of the process could be useful for debugging purposes in some situations, as the log_rank() function does:

httomo/httomo/utils.py

Lines 62 to 73 in 8ccf663

def log_rank(output: Any, comm: MPI.Comm) -> None:
"""
Log output to log file with the process rank.
Parameters
----------
output : Any
The item to be printed.
comm : Comm
The comm used to determine the process rank.
"""
logger.debug(f"RANK: [{comm.rank}], {output}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    loggingminorNice to do but not vital

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions