Skip to content

Commit

Permalink
use absolute paths for file logs to directly save in prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Moors committed Sep 12, 2023
1 parent 5d5ba7f commit b3ea0c3
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 51 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ cd /path/to/EESSI/test-suite
module load ReFrame/4.2.0
export PYTHONPATH=$PWD:$PYTHONPATH
export RFM_PREFIX=<path_to_all_output>
reframe \
--config-file <path_to_site_config_file> \
--checkpath eessi/testsuite/tests/apps \
--prefix <path_to_all_output> \
--save-log-files \
--tag CI --tag 1_node \
--run --performance-report
```
Expand Down
8 changes: 3 additions & 5 deletions config/aws_citc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
from eessi.testsuite.common_config import common_logging_config
from eessi.testsuite.constants import FEATURES

# This config will write all staging, output (and logging with --save-log-files) to subdirs under this prefix
# Override with --prefix
reframe_prefix = f'{os.environ.get("HOME")}/reframe_runs'
# This config will write all staging, output and logging to subdirs under this prefix
reframe_prefix = os.path.join(os.environ['HOME'], 'reframe_runs')

# AWS CITC site configuration
site_configuration = {
Expand Down Expand Up @@ -116,11 +115,10 @@
'ftn': '',
},
],
'logging': common_logging_config,
'logging': common_logging_config(reframe_prefix),
'general': [
{
'remote_detect': True,
'save_log_files': True,
}
],
}
Expand Down
3 changes: 1 addition & 2 deletions config/github_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
{
'purge_environment': True,
'resolve_module_conflicts': False, # avoid loading the module before submitting the job
'save_log_files': True,
}
],
'logging': common_logging_config,
'logging': common_logging_config(),
}
8 changes: 3 additions & 5 deletions config/izum_vega.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from eessi.testsuite.common_config import common_logging_config
from eessi.testsuite.constants import * # noqa: F403

# This config will write all staging, output (and logging with --save-log-files) to subdirs under this prefix
# Override with --prefix
reframe_prefix = f'{os.environ.get("HOME")}/reframe_runs'
# This config will write all staging, output and logging to subdirs under this prefix
reframe_prefix = os.path.join(os.environ['HOME'], 'reframe_runs')

# This is an example configuration file
site_configuration = {
Expand All @@ -14,7 +13,6 @@
# Enable automatic detection of CPU architecture for each partition
# See https://reframe-hpc.readthedocs.io/en/stable/configure.html#auto-detecting-processor-information
'remote_detect': True,
'save_log_files': True,
}
],
'systems': [
Expand Down Expand Up @@ -94,5 +92,5 @@
'ftn': '',
},
],
'logging': common_logging_config,
'logging': common_logging_config(reframe_prefix),
}
5 changes: 1 addition & 4 deletions config/settings_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@
'ftn': '',
},
],
'logging': common_logging_config,
'general': {
'save_log_files': True, # copy ReFrame file logs to <prefix>/output on exit
},
'logging': common_logging_config(),
}

# optional logging to syslog
Expand Down
3 changes: 1 addition & 2 deletions config/surf_snellius.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@
'ftn': '',
},
],
'logging': common_logging_config,
'logging': common_logging_config(),
'general': [
{
# For autodetect to work, temporarily change:
# 1. The launchers to srun
# 2. Add --exclusive to GPU 'access' field above (avoids submission error that no GPUs are requested)
'remote_detect': True,
'save_log_files': True,
}
],
}
3 changes: 1 addition & 2 deletions config/vsc_hortense.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ def command(self, job):
{
'purge_environment': True,
'resolve_module_conflicts': False, # avoid loading the module before submitting the job
'save_log_files': True,
}
],
'logging': common_logging_config,
'logging': common_logging_config(),
}
70 changes: 41 additions & 29 deletions eessi/testsuite/common_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

perflog_format = '|'.join([
'%(check_job_completion_time)s',
'%(osuser)s',
Expand Down Expand Up @@ -27,32 +29,42 @@
'' # final delimiter required
])

common_logging_config = [{
'level': 'debug',
'handlers': [
{
'type': 'stream',
'name': 'stdout',
'level': 'info',
'format': '%(message)s',
},
{
'type': 'file',
'name': 'reframe.log',
'level': 'debug',
'format': '[%(asctime)s] %(levelname)s: %(check_info)s: %(message)s',
'append': True,
'timestamp': "%Y%m%d_%H%M%S", # add a timestamp to the filename (reframe_<timestamp>.log)
},
],
'handlers_perflog': [
{
'type': 'filelog',
'prefix': '%(check_system)s/%(check_partition)s',
'level': 'info',
'format': perflog_format,
'format_perfvars': format_perfvars,
'append': True, # avoid overwriting
},
],
}]

def common_logging_config(prefix=None):
"""
return default logging configuration as a list: stdout, file log, perflog
:param prefix: file log prefix
"""
prefix = os.getenv('RFM_PREFIX', prefix if prefix else '.')

os.makedirs(os.path.join(prefix, 'log'), exist_ok=True)

return [{
'level': 'debug',
'handlers': [
{
'type': 'stream',
'name': 'stdout',
'level': 'info',
'format': '%(message)s',
},
{
'type': 'file',
'name': os.path.join(prefix, 'log', 'reframe.log'),
'level': 'debug',
'format': '[%(asctime)s] %(levelname)s: %(check_info)s: %(message)s',
'append': True,
'timestamp': "%Y%m%d_%H%M%S", # add a timestamp to the filename (reframe_<timestamp>.log)
},
],
'handlers_perflog': [
{
'type': 'filelog',
'prefix': '%(check_system)s/%(check_partition)s',
'level': 'info',
'format': perflog_format,
'format_perfvars': format_perfvars,
'append': True, # avoid overwriting
},
],
}]

0 comments on commit b3ea0c3

Please sign in to comment.