Skip to content

Commit 067f364

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into docs/refine-docs
2 parents 6aee86b + 6cee3d4 commit 067f364

File tree

11 files changed

+56
-36
lines changed

11 files changed

+56
-36
lines changed

ci-scripts/ci-runner.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ elif [ $CI_TUTORIAL -eq 1 ]; then
158158
# Run tutorial checks
159159
# Find modified or added tutorial checks
160160
tutorialchecks=( $(git diff origin/master...HEAD --name-only --oneline --no-merges | \
161-
grep -e '^tutorial/(?!config/).*\.py') )
161+
grep -e '^tutorial/.*\.py') )
162162

163163
if [ ${#tutorialchecks[@]} -ne 0 ]; then
164164
tutorialchecks_path=""

docs/config_reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ General Configuration
10091009
.. js:attribute:: .general[].check_search_recursive
10101010

10111011
:required: No
1012-
:default: ``true``
1012+
:default: ``false``
10131013

10141014
Search directories in the `search path <#.general[].check_search_path>`__ recursively.
10151015

docs/migration_2_to_3.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,24 @@ As soon as it detects an old-style configuration file, it will convert it to the
2424
./bin/reframe: the syntax of the configuration file 'unittests/resources/settings_old_syntax.py' is deprecated
2525
./bin/reframe: configuration file has been converted to the new syntax here: '/var/folders/h7/k7cgrdl13r996m4dmsvjq7v80000gp/T/tmph5n8u3kf.py'
2626
27-
Alternatively, you can convert any old configuration file using the conversion tool ``tools/convert_config.py``:
27+
Alternatively, you can convert any old configuration file using the conversion tool |convert_config|_:
28+
29+
.. |convert_config| replace:: :obj:`convert-config`
30+
.. _convert_config: https://github.com/eth-cscs/reframe/blob/master/tools/convert-config
2831

2932
.. code-block:: none
3033
31-
$ ./tools/convert-config unittests/resources/settings_old_syntax.py
32-
Conversion successful! The converted file can be found at '/var/folders/h7/k7cgrdl13r996m4dmsvjq7v80000gp/T/tmpz4f6yer4.py'.
34+
$ ./tools/convert-config unittests/resources/settings_old_syntax.py new_config.py
35+
Conversion successful! The converted file can be found at 'new_config.py'.
3336
3437
3538
Another important change is that default locations for looking up a configuration file has changed (see `Configuring ReFrame for Your Site <configure.html>`__ for more details).
3639
That practically means that if you were relying on ReFrame loading your ``reframe/settings.py`` by default, this is no longer true.
3740
You have to move it to any of the default settings locations or set the corresponding command line option or environment variable.
3841

42+
.. note::
43+
The conversion tool will create a JSON configuration file if the extension of the target file is ``.json``.
44+
3945

4046
Automatic conversion limitations
4147
================================

reframe/core/config.py

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,14 @@ def convert_old_config(filename, newfilename=None):
381381
'environments': [],
382382
'logging': [],
383383
}
384-
perflogdir = None
384+
perflogdir = {}
385385
old_systems = old_config.site_configuration['systems'].items()
386386
for sys_name, sys_spec in old_systems:
387387
sys_dict = {'name': sys_name}
388388

389-
# FIXME: We pick the perflogdir that we first find we use it as
390-
# filelog's basedir for all systems. This is not correct since
391-
# per-system customizations of perflogdir will be lost
392-
if perflogdir is None:
393-
perflogdir = sys_spec.pop('perflogdir', None)
389+
system_perflogdir = sys_spec.pop('perflogdir', None)
390+
perflogdir.setdefault(system_perflogdir, [])
391+
perflogdir[system_perflogdir].append(sys_name)
394392

395393
sys_dict.update(sys_spec)
396394

@@ -482,34 +480,40 @@ def convert_old_config(filename, newfilename=None):
482480

483481
converted['modes'].append(new_mode)
484482

485-
def handler_list(handler_config):
483+
def handler_list(handler_config, basedir=None):
486484
ret = []
487485
for h in handler_config:
488-
new_h = h
486+
new_h = h.copy()
489487
new_h['level'] = h['level'].lower()
490488
if h['type'] == 'graylog':
491489
# `host` and `port` attribute are converted to `address`
492490
new_h['address'] = h['host']
493491
if 'port' in h:
494492
new_h['address'] += ':' + h['port']
495-
elif h['type'] == 'filelog' and perflogdir is not None:
496-
new_h['basedir'] = perflogdir
493+
elif h['type'] == 'filelog' and basedir is not None:
494+
new_h['basedir'] = basedir
497495

498496
ret.append(new_h)
499497

500498
return ret
501499

502-
converted['logging'].append(
503-
{
504-
'level': old_config.logging_config['level'].lower(),
505-
'handlers': handler_list(
506-
old_config.logging_config['handlers']
507-
),
508-
'handlers_perflog': handler_list(
509-
old_config.perf_logging_config['handlers']
510-
)
511-
}
512-
)
500+
for basedir, target_systems in perflogdir.items():
501+
converted['logging'].append(
502+
{
503+
'level': old_config.logging_config['level'].lower(),
504+
'handlers': handler_list(
505+
old_config.logging_config['handlers']
506+
),
507+
'handlers_perflog': handler_list(
508+
old_config.perf_logging_config['handlers'],
509+
basedir=basedir
510+
),
511+
'target_systems': target_systems
512+
}
513+
)
514+
if basedir is None:
515+
del converted['logging'][-1]['target_systems']
516+
513517
converted['general'] = [{}]
514518
if hasattr(old_config, 'checks_path'):
515519
converted['general'][0][
@@ -528,9 +532,16 @@ def handler_list(handler_config):
528532
f"by ReFrame based on '{filename}'.\n#\n\n"
529533
f"site_configuration = {util.ppretty(converted)}\n")
530534

535+
contents = '\n'.join(l if len(l) < 80 else f'{l} # noqa: E501'
536+
for l in contents.split('\n'))
537+
531538
if newfilename:
532539
with open(newfilename, 'w') as fp:
533-
fp.write(contents)
540+
if newfilename.endswith('.json'):
541+
json.dump(converted, fp, indent=4)
542+
else:
543+
fp.write(contents)
544+
534545
else:
535546
with tempfile.NamedTemporaryFile(mode='w', suffix='.py',
536547
delete=False) as fp:

reframe/frontend/cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ def main():
332332
logging.getlogger().colorize = site_config.get('general/0/colorize')
333333
printer = PrettyPrinter()
334334
printer.colorize = site_config.get('general/0/colorize')
335-
if options.verbose:
336-
printer.inc_verbosity(options.verbose)
335+
printer.inc_verbosity(site_config.get('general/0/verbose'))
337336

338337
# Now configure ReFrame according to the user configuration file
339338
try:
@@ -360,6 +359,7 @@ def main():
360359

361360
logging.getlogger().colorize = site_config.get('general/0/colorize')
362361
printer.colorize = site_config.get('general/0/colorize')
362+
printer.inc_verbosity(site_config.get('general/0/verbose'))
363363
try:
364364
runtime.init_runtime(site_config)
365365
except ConfigError as e:
@@ -436,7 +436,7 @@ def print_infoline(param, value):
436436
f"{os_ext.osuser() or '<unknown>'}@{socket.gethostname()}")
437437
print_infoline('working directory', repr(os.getcwd()))
438438
print_infoline('check search path',
439-
f"{'(R)' if loader.recurse else ''} "
439+
f"{'(R) ' if loader.recurse else ''}"
440440
f"{':'.join(loader.load_path)!r}")
441441
print_infoline('stage directory', repr(rt.stage_prefix))
442442
print_infoline('output directory', repr(rt.output_prefix))

reframe/frontend/statistics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def performance_report(self):
165165
line_width = 78
166166
report_start = line_width * '='
167167
report_title = 'PERFORMANCE REPORT'
168-
report_end = line_width * '_'
168+
report_end = line_width * '-'
169169
report_body = []
170170
previous_name = ''
171171
previous_part = ''

schemas/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
"environments/ldflags": [],
387387
"environments/target_systems": ["*"],
388388
"general/check_search_path": ["${RFM_INSTALL_PREFIX}/checks/"],
389-
"general/check_search_recursive": true,
389+
"general/check_search_recursive": false,
390390
"general/colorize": true,
391391
"general/ignore_check_conflicts": false,
392392
"general/keep_stage_files": false,

tools/convert_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
print(f'{sys.argv[0]}: too few arguments', file=sys.stderr)
2121
print(f'Usage: {sys.argv[0]} OLD_CONFIG_FILE [NEW_CONFIG_FILE]',
2222
file=sys.stderr)
23+
print(' Use the extension of NEW_CONFIG_FILE to specify\n'
24+
' python (.py) or json (.json) format.',
25+
file=sys.stderr)
2326
sys.exit(1)
2427

2528
try:

tutorial/config/settings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
],
4444
'container_platforms': [
4545
{
46-
'name': 'Singularity',
46+
'type': 'Singularity',
4747
'modules': ['Singularity']
4848
}
4949
],
@@ -64,7 +64,7 @@
6464
],
6565
'container_platforms': [
6666
{
67-
'name': 'Singularity',
67+
'type': 'Singularity',
6868
'modules': ['Singularity']
6969
}
7070
],
@@ -131,7 +131,6 @@
131131
'general': [
132132
{
133133
'check_search_path': ['tutorial/'],
134-
'check_search_recursive': True
135134
}
136135
]
137136
}

unittests/test_argparser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_option_with_config(extended_parser):
156156
['--timestamp=%FT%T', '--nocolor']
157157
)
158158
options.update_config(site_config)
159-
assert site_config.get('general/0/check_search_recursive') is True
159+
assert site_config.get('general/0/check_search_recursive') is False
160160
assert site_config.get('general/0/timestamp_dirs') == '%FT%T'
161161
assert site_config.get('general/0/non_default_craype') is True
162162
assert site_config.get('systems/0/prefix') == '.'

0 commit comments

Comments
 (0)