From a0cf25b0f904aa760120c5e257390fa5c95bc464 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 19 Feb 2020 18:01:44 +0100 Subject: [PATCH 01/23] Add tool that converts the old configuration to json object --- reframe/core/config.py | 103 +++++++++++++++++++++++++++++++++++++++++ schemas/config.json | 6 +-- schemas/settings.py | 12 +++-- 3 files changed, 115 insertions(+), 6 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 967f0e18f9..cbae2db0f2 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -1,4 +1,5 @@ import collections.abc +import json import re import reframe.core.debug as debug @@ -217,3 +218,105 @@ def create_env(system, partition, name): system.add_partition(part) self._systems[sys_name] = system + + +def create_json_object(): + if _settings is None: + raise ReframeFatalError('ReFrame is not configured') + + json_configuration = { + 'systems': [], + 'environments': [], + 'logging': [], + 'perf_logging': [], + } + for sys_name, sys_specs in _settings.site_configuration['systems'].items(): + sys_dict = {'name': sys_name} + sys_dict.update(sys_specs) + # Make variables dictionary into a list of lists + if 'variables' in sys_specs: + sys_dict['variables'] = [] + for vname, v in sys_specs['variables'].items(): + sys_dict['variables'].append([vname, v]) + # Make partitions dictionary into a list + if 'partitions' in sys_specs: + sys_dict['partitions'] = [] + for pname, p in sys_specs['partitions'].items(): + new_p = {'name': pname} + new_p.update(p) + if p['scheduler'] == 'nativeslurm': + new_p['scheduler'] = 'slurm' + new_p['launcher'] = 'srun' + elif p['scheduler'] == 'local': + new_p['scheduler'] = 'local' + new_p['launcher'] = 'local' + else: + sched = p['scheduler'].split('+')[0] + launch = p['scheduler'].split('+')[0] + new_p['scheduler'] = sched + new_p['launcher'] = launch + # Make resources dictionary into a list + if 'resources' in p: + new_p['resources'] = [] + for rname, r in p['resources'].items(): + new_r = {'name': rname, 'options': r} + new_p['resources'].append(new_r) + + # Make variables dictionary into a list of lists + if 'variables' in p: + new_p['variables'] = [] + for vname, v in p['variables'].items(): + new_p['variables'].append([vname, v]) + + sys_dict['partitions'].append(new_p) + + json_configuration['systems'].append(sys_dict) + + for env_target, env_entries in _settings.site_configuration['environments'].items(): + for ename, e in env_entries.items(): + new_env = {'name': ename} + if (env_target != '*'): + new_env['target_systems'] = [env_target] + + new_env.update(e) + json_configuration['environments'].append(new_env) + + if 'modes' in _settings.site_configuration: + json_configuration['modes'] = [] + for target_mode, mode_entries in _settings.site_configuration['modes'].items(): + for mname, m in mode_entries.items(): + new_mode = {'name': mname, 'options': m} + if target_mode != '*': + new_mode['target_systems'] = [target_mode] + + json_configuration['modes'].append(new_mode) + + def update_config(log_name, original_log): + new_handlers = [] + for h in original_log['handlers']: + new_h = h + new_h['level'] = h['level'].lower() + new_handlers.append(new_h) + + json_configuration[log_name].append( + { + 'level': original_log['level'].lower(), + 'handlers': new_handlers + } + ) + + update_config('logging', _settings.logging_config) + update_config('perf_logging', _settings.perf_logging_config) + + if (hasattr(_settings, 'checks_path') or + hasattr(_settings, 'checks_path_recurse')): + json_configuration['general'] = [{}] + if hasattr(_settings, 'checks_path'): + json_configuration['general'][0][ + 'check_search_path' + ] = _settings.checks_path + + if hasattr(_settings, 'checks_path_recurse'): + json_configuration['general'][0][ + 'check_search_recursive' + ] = _settings.checks_path_recurse diff --git a/schemas/config.json b/schemas/config.json index c837c2aea4..34c4bcd1ee 100644 --- a/schemas/config.json +++ b/schemas/config.json @@ -310,7 +310,7 @@ "modes": { "type": "array", "items": { - "type": "object", + "type": "object", "properties": { "name": {"type": "string"}, "options": { @@ -350,13 +350,13 @@ "general/check_search_recursive": "true", "general/target_systems": ["*"], "perf_logging/target_systems": ["*"], - "logging/handlers/level": "DEBUG", + "logging/handlers/level": "debug", "logging/handlers/file/append": false, "logging/handlers/file/timestamp": false, "logging/handlers/stream/name": "stdout", "logging/handlers/syslog/socktype": "udp", "logging/handlers/syslog/facility": "user", - "logging/level": "INFO", + "logging/level": "info", "logging/target_systems": ["*"], "modes/target_systems": ["*"], "schedulers/job_submit_timeout": 60, diff --git a/schemas/settings.py b/schemas/settings.py index f56283b103..9e4c6b0a1b 100644 --- a/schemas/settings.py +++ b/schemas/settings.py @@ -63,7 +63,7 @@ }, { 'name': 'sys0', - 'descr': 'System for testing check dependencies', + 'descr': 'System for test dependencies unit tests', 'hostnames': [r'sys\d+'], 'partitions': [ { @@ -141,7 +141,7 @@ 'format': ('[%(asctime)s] %(levelname)s: ' '%(check_name)s: %(message)s'), 'datefmt': '%FT%T', - 'append': False, + 'append': false, }, { 'type': 'stream', @@ -169,9 +169,15 @@ 'u=%(check_perf_upper_thres)s)|' '%(check_perf_unit)s' ), - 'append': True + 'append': true } ] } ] + 'general': [ + { + 'check_search_path': ['checks/'], + 'check_search_recursive': true + } + ], } From eb3134317c4cd967d00bdd0e090be61c11f656a5 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 19 Feb 2020 18:22:36 +0100 Subject: [PATCH 02/23] Minor fixes --- reframe/core/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index cbae2db0f2..286594802c 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -252,9 +252,10 @@ def create_json_object(): new_p['launcher'] = 'local' else: sched = p['scheduler'].split('+')[0] - launch = p['scheduler'].split('+')[0] + launch = p['scheduler'].split('+')[1] new_p['scheduler'] = sched new_p['launcher'] = launch + # Make resources dictionary into a list if 'resources' in p: new_p['resources'] = [] From 09cf1a24fe6209309e672b2f543f32f4fd5481f4 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Thu, 20 Feb 2020 16:10:53 +0100 Subject: [PATCH 03/23] Fix boolean values --- schemas/settings.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schemas/settings.py b/schemas/settings.py index 9e4c6b0a1b..6c597849f6 100644 --- a/schemas/settings.py +++ b/schemas/settings.py @@ -141,7 +141,7 @@ 'format': ('[%(asctime)s] %(levelname)s: ' '%(check_name)s: %(message)s'), 'datefmt': '%FT%T', - 'append': false, + 'append': False, }, { 'type': 'stream', @@ -169,7 +169,7 @@ 'u=%(check_perf_upper_thres)s)|' '%(check_perf_unit)s' ), - 'append': true + 'append': True } ] } @@ -177,7 +177,7 @@ 'general': [ { 'check_search_path': ['checks/'], - 'check_search_recursive': true + 'check_search_recursive': True } ], } From 666790d37e10a4e17682806cc0ef1ab84acc330d Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Mon, 24 Feb 2020 10:48:17 +0100 Subject: [PATCH 04/23] Change interface of the tool --- reframe/core/config.py | 61 +++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 286594802c..abafaa666a 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -1,13 +1,14 @@ import collections.abc import json import re +import tempfile import reframe.core.debug as debug import reframe.core.fields as fields import reframe.utility as util import reframe.utility.os_ext as os_ext import reframe.utility.typecheck as types -from reframe.core.exceptions import (ConfigError, ReframeFatalError) +from reframe.core.exceptions import (ConfigError, ReframeFatalError, ReframeError) _settings = None @@ -220,17 +221,24 @@ def create_env(system, partition, name): self._systems[sys_name] = system -def create_json_object(): - if _settings is None: +def convert_old_config(filename): + try: + old_config = load_settings_from_file(filename) + except (OSError, ReframeError) as e: + sys.stderr.write( + '%s: could not load settings: %s\n' % (sys.argv[0], e)) + sys.exit(1) + + if old_config is None: raise ReframeFatalError('ReFrame is not configured') - json_configuration = { + converted = { 'systems': [], 'environments': [], 'logging': [], 'perf_logging': [], } - for sys_name, sys_specs in _settings.site_configuration['systems'].items(): + for sys_name, sys_specs in old_config.site_configuration['systems'].items(): sys_dict = {'name': sys_name} sys_dict.update(sys_specs) # Make variables dictionary into a list of lists @@ -271,26 +279,26 @@ def create_json_object(): sys_dict['partitions'].append(new_p) - json_configuration['systems'].append(sys_dict) + converted['systems'].append(sys_dict) - for env_target, env_entries in _settings.site_configuration['environments'].items(): + for env_target, env_entries in old_config.site_configuration['environments'].items(): for ename, e in env_entries.items(): new_env = {'name': ename} if (env_target != '*'): new_env['target_systems'] = [env_target] new_env.update(e) - json_configuration['environments'].append(new_env) + converted['environments'].append(new_env) - if 'modes' in _settings.site_configuration: - json_configuration['modes'] = [] - for target_mode, mode_entries in _settings.site_configuration['modes'].items(): + if 'modes' in old_config.site_configuration: + converted['modes'] = [] + for target_mode, mode_entries in old_config.site_configuration['modes'].items(): for mname, m in mode_entries.items(): new_mode = {'name': mname, 'options': m} if target_mode != '*': new_mode['target_systems'] = [target_mode] - json_configuration['modes'].append(new_mode) + converted['modes'].append(new_mode) def update_config(log_name, original_log): new_handlers = [] @@ -299,25 +307,30 @@ def update_config(log_name, original_log): new_h['level'] = h['level'].lower() new_handlers.append(new_h) - json_configuration[log_name].append( + converted[log_name].append( { 'level': original_log['level'].lower(), 'handlers': new_handlers } ) - update_config('logging', _settings.logging_config) - update_config('perf_logging', _settings.perf_logging_config) + update_config('logging', old_config.logging_config) + update_config('perf_logging', old_config.perf_logging_config) - if (hasattr(_settings, 'checks_path') or - hasattr(_settings, 'checks_path_recurse')): - json_configuration['general'] = [{}] - if hasattr(_settings, 'checks_path'): - json_configuration['general'][0][ + if (hasattr(old_config, 'checks_path') or + hasattr(old_config, 'checks_path_recurse')): + converted['general'] = [{}] + if hasattr(old_config, 'checks_path'): + converted['general'][0][ 'check_search_path' - ] = _settings.checks_path + ] = old_config.checks_path - if hasattr(_settings, 'checks_path_recurse'): - json_configuration['general'][0][ + if hasattr(old_config, 'checks_path_recurse'): + converted['general'][0][ 'check_search_recursive' - ] = _settings.checks_path_recurse + ] = old_config.checks_path_recurse + + with tempfile.NamedTemporaryFile(mode='w', delete = False) as fp: + fp.write(json.dumps(converted, indent=4)) + + return fp.name From 6815be5b04c2645a547b3a64b61b1670d908c94c Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Mon, 24 Feb 2020 10:55:00 +0100 Subject: [PATCH 05/23] Change json dump function --- reframe/core/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index abafaa666a..9e6d98a4e3 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -331,6 +331,6 @@ def update_config(log_name, original_log): ] = old_config.checks_path_recurse with tempfile.NamedTemporaryFile(mode='w', delete = False) as fp: - fp.write(json.dumps(converted, indent=4)) + json.dump(converted, fp, indent=4) return fp.name From e0cc3b516be14a4e8734da6cd9fd30107c2e32ae Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Mon, 24 Feb 2020 16:15:50 +0100 Subject: [PATCH 06/23] Fix PEP8 issues --- reframe/core/config.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 9e6d98a4e3..0535de4c62 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -8,7 +8,8 @@ import reframe.utility as util import reframe.utility.os_ext as os_ext import reframe.utility.typecheck as types -from reframe.core.exceptions import (ConfigError, ReframeFatalError, ReframeError) +from reframe.core.exceptions import (ConfigError, ReframeError, + ReframeFatalError) _settings = None @@ -238,7 +239,8 @@ def convert_old_config(filename): 'logging': [], 'perf_logging': [], } - for sys_name, sys_specs in old_config.site_configuration['systems'].items(): + old_systems = old_config.site_configuration['systems'].items() + for sys_name, sys_specs in old_systems: sys_dict = {'name': sys_name} sys_dict.update(sys_specs) # Make variables dictionary into a list of lists @@ -281,7 +283,8 @@ def convert_old_config(filename): converted['systems'].append(sys_dict) - for env_target, env_entries in old_config.site_configuration['environments'].items(): + old_environs = old_config.site_configuration['environments'].items() + for env_target, env_entries in old_environs: for ename, e in env_entries.items(): new_env = {'name': ename} if (env_target != '*'): @@ -292,7 +295,8 @@ def convert_old_config(filename): if 'modes' in old_config.site_configuration: converted['modes'] = [] - for target_mode, mode_entries in old_config.site_configuration['modes'].items(): + old_modes = old_config.site_configuration['modes'].items() + for target_mode, mode_entries in old_modes: for mname, m in mode_entries.items(): new_mode = {'name': mname, 'options': m} if target_mode != '*': @@ -330,7 +334,7 @@ def update_config(log_name, original_log): 'check_search_recursive' ] = old_config.checks_path_recurse - with tempfile.NamedTemporaryFile(mode='w', delete = False) as fp: + with tempfile.NamedTemporaryFile(mode='w', delete=False) as fp: json.dump(converted, fp, indent=4) return fp.name From 381895e3bd9790c94d5a800fd9f211896b9b1991 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 26 Feb 2020 10:35:24 +0100 Subject: [PATCH 07/23] Address PR comments --- reframe/core/config.py | 63 ++++++++++++++------------------- schemas/settings.py | 8 +---- unittests/resources/settings.py | 2 +- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 0535de4c62..ec92515e6a 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -223,16 +223,7 @@ def create_env(system, partition, name): def convert_old_config(filename): - try: - old_config = load_settings_from_file(filename) - except (OSError, ReframeError) as e: - sys.stderr.write( - '%s: could not load settings: %s\n' % (sys.argv[0], e)) - sys.exit(1) - - if old_config is None: - raise ReframeFatalError('ReFrame is not configured') - + old_config = load_settings_from_file(filename) converted = { 'systems': [], 'environments': [], @@ -245,9 +236,10 @@ def convert_old_config(filename): sys_dict.update(sys_specs) # Make variables dictionary into a list of lists if 'variables' in sys_specs: - sys_dict['variables'] = [] - for vname, v in sys_specs['variables'].items(): - sys_dict['variables'].append([vname, v]) + sys_dict['variables'] = [ + [vname, v] for vname, v in sys_dict['variables'].items() + ] + # Make partitions dictionary into a list if 'partitions' in sys_specs: sys_dict['partitions'] = [] @@ -261,23 +253,22 @@ def convert_old_config(filename): new_p['scheduler'] = 'local' new_p['launcher'] = 'local' else: - sched = p['scheduler'].split('+')[0] - launch = p['scheduler'].split('+')[1] + sched, launch, *_ = p['scheduler'].split('+') new_p['scheduler'] = sched new_p['launcher'] = launch # Make resources dictionary into a list if 'resources' in p: - new_p['resources'] = [] - for rname, r in p['resources'].items(): - new_r = {'name': rname, 'options': r} - new_p['resources'].append(new_r) + new_p['resources'] = [ + {'name': rname, 'options': r} + for rname, r in p['resources'].items() + ] # Make variables dictionary into a list of lists if 'variables' in p: - new_p['variables'] = [] - for vname, v in p['variables'].items(): - new_p['variables'].append([vname, v]) + new_p['variables'] = [ + [vname, v] for vname, v in p['variables'].items() + ] sys_dict['partitions'].append(new_p) @@ -287,7 +278,7 @@ def convert_old_config(filename): for env_target, env_entries in old_environs: for ename, e in env_entries.items(): new_env = {'name': ename} - if (env_target != '*'): + if env_target != '*': new_env['target_systems'] = [env_target] new_env.update(e) @@ -320,19 +311,19 @@ def update_config(log_name, original_log): update_config('logging', old_config.logging_config) update_config('perf_logging', old_config.perf_logging_config) - - if (hasattr(old_config, 'checks_path') or - hasattr(old_config, 'checks_path_recurse')): - converted['general'] = [{}] - if hasattr(old_config, 'checks_path'): - converted['general'][0][ - 'check_search_path' - ] = old_config.checks_path - - if hasattr(old_config, 'checks_path_recurse'): - converted['general'][0][ - 'check_search_recursive' - ] = old_config.checks_path_recurse + converted['general'] = [{}] + if hasattr(old_config, 'checks_path'): + converted['general'][0][ + 'check_search_path' + ] = old_config.checks_path + + if hasattr(old_config, 'checks_path_recurse'): + converted['general'][0][ + 'check_search_recursive' + ] = old_config.checks_path_recurse + + if converted['general'] == [{}]: + del converted['general'] with tempfile.NamedTemporaryFile(mode='w', delete=False) as fp: json.dump(converted, fp, indent=4) diff --git a/schemas/settings.py b/schemas/settings.py index 6c597849f6..78e0bb551d 100644 --- a/schemas/settings.py +++ b/schemas/settings.py @@ -63,7 +63,7 @@ }, { 'name': 'sys0', - 'descr': 'System for test dependencies unit tests', + 'descr': 'System for checking test dependencies', 'hostnames': [r'sys\d+'], 'partitions': [ { @@ -174,10 +174,4 @@ ] } ] - 'general': [ - { - 'check_search_path': ['checks/'], - 'check_search_recursive': True - } - ], } diff --git a/unittests/resources/settings.py b/unittests/resources/settings.py index 06fe5fee35..e3a7037a0d 100644 --- a/unittests/resources/settings.py +++ b/unittests/resources/settings.py @@ -61,7 +61,7 @@ class ReframeSettings: }, 'sys0': { # System used for dependency checking - 'descr': 'System for test dependencies unit tests', + 'descr': 'System for checking test dependencies', 'hostnames': [r'sys\d+'], 'partitions': { 'p0': { From 5f2aea3197f25033365931dbb4bc8db687c04fa2 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Thu, 5 Mar 2020 13:19:45 +0100 Subject: [PATCH 08/23] Add printing function for the configuration --- reframe/core/config.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index ec92515e6a..5e404b5e84 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -222,6 +222,37 @@ def create_env(system, partition, name): self._systems[sys_name] = system +def str_configuration(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): + nlch = lfchar + htchar * indent * (current_depth + 1) + if type(value) is dict: + if value == {}: + return '\{\}' + items = [ + nlch + repr(key) + ': ' + + pretty(value[key], htchar, lfchar, indent, current_depth + 1) + for key in value + ] + return '{%s}' % (','.join(items) + lfchar + htchar * indent * current_depth) + elif type(value) is list: + if value == []: + return '[]' + items = [ + nlch + pretty(item, htchar, lfchar, indent, current_depth + 1) + for item in value + ] + return '[%s]' % (','.join(items) + lfchar + htchar * indent * current_depth) + elif type(value) is tuple: + if value == (): + return '()' + items = [ + nlch + pretty(item, htchar, lfchar, indent, current_depth + 1) + for item in value + ] + return '(%s)' % (','.join(items) + lfchar + htchar * indent * current_depth) + else: + return repr(value) + + def convert_old_config(filename): old_config = load_settings_from_file(filename) converted = { @@ -326,6 +357,10 @@ def update_config(log_name, original_log): del converted['general'] with tempfile.NamedTemporaryFile(mode='w', delete=False) as fp: - json.dump(converted, fp, indent=4) + fp.write('#\n# This file was automatically generated ' + 'by ReFrame based on `{}\'.\n#\n\n'.format(filename)) + fp.write('site_configuration = ') + fp.write(pretty(converted)) + fp.write('\n') return fp.name From 76fceddd701f2430cdf917572c8137bce8fe1968 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Thu, 5 Mar 2020 14:55:55 +0100 Subject: [PATCH 09/23] Fix typo in formatting function --- reframe/core/config.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 5e404b5e84..7f3860667f 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -222,14 +222,14 @@ def create_env(system, partition, name): self._systems[sys_name] = system -def str_configuration(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): +def ppretty(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): nlch = lfchar + htchar * indent * (current_depth + 1) if type(value) is dict: if value == {}: return '\{\}' items = [ nlch + repr(key) + ': ' + - pretty(value[key], htchar, lfchar, indent, current_depth + 1) + ppretty(value[key], htchar, lfchar, indent, current_depth + 1) for key in value ] return '{%s}' % (','.join(items) + lfchar + htchar * indent * current_depth) @@ -237,7 +237,7 @@ def str_configuration(value, htchar=' ', lfchar='\n', indent=4, current_depth=0) if value == []: return '[]' items = [ - nlch + pretty(item, htchar, lfchar, indent, current_depth + 1) + nlch + ppretty(item, htchar, lfchar, indent, current_depth + 1) for item in value ] return '[%s]' % (','.join(items) + lfchar + htchar * indent * current_depth) @@ -245,7 +245,7 @@ def str_configuration(value, htchar=' ', lfchar='\n', indent=4, current_depth=0) if value == (): return '()' items = [ - nlch + pretty(item, htchar, lfchar, indent, current_depth + 1) + nlch + ppretty(item, htchar, lfchar, indent, current_depth + 1) for item in value ] return '(%s)' % (','.join(items) + lfchar + htchar * indent * current_depth) @@ -360,7 +360,7 @@ def update_config(log_name, original_log): fp.write('#\n# This file was automatically generated ' 'by ReFrame based on `{}\'.\n#\n\n'.format(filename)) fp.write('site_configuration = ') - fp.write(pretty(converted)) + fp.write(ppretty(converted)) fp.write('\n') return fp.name From 97f8fe007acce001da337e809963afad2e223c0a Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Fri, 6 Mar 2020 09:21:30 +0100 Subject: [PATCH 10/23] Fix formatting issues --- reframe/core/config.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 7f3860667f..fb45a06f69 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -226,13 +226,14 @@ def ppretty(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): nlch = lfchar + htchar * indent * (current_depth + 1) if type(value) is dict: if value == {}: - return '\{\}' + return '{}' items = [ nlch + repr(key) + ': ' + ppretty(value[key], htchar, lfchar, indent, current_depth + 1) for key in value ] - return '{%s}' % (','.join(items) + lfchar + htchar * indent * current_depth) + return '{%s}' % (','.join(items) + lfchar + + htchar * indent * current_depth) elif type(value) is list: if value == []: return '[]' @@ -240,7 +241,8 @@ def ppretty(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): nlch + ppretty(item, htchar, lfchar, indent, current_depth + 1) for item in value ] - return '[%s]' % (','.join(items) + lfchar + htchar * indent * current_depth) + return '[%s]' % (','.join(items) + lfchar + + htchar * indent * current_depth) elif type(value) is tuple: if value == (): return '()' @@ -248,7 +250,8 @@ def ppretty(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): nlch + ppretty(item, htchar, lfchar, indent, current_depth + 1) for item in value ] - return '(%s)' % (','.join(items) + lfchar + htchar * indent * current_depth) + return '(%s)' % (','.join(items) + lfchar + + htchar * indent * current_depth) else: return repr(value) @@ -265,6 +268,7 @@ def convert_old_config(filename): for sys_name, sys_specs in old_systems: sys_dict = {'name': sys_name} sys_dict.update(sys_specs) + # Make variables dictionary into a list of lists if 'variables' in sys_specs: sys_dict['variables'] = [ From 4a46f463b9806e807ef157da7e680206c05131d4 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 11 Mar 2020 18:21:44 +0100 Subject: [PATCH 11/23] Fixes in the formatting function --- reframe/core/config.py | 48 +++++-------------------------------- reframe/utility/__init__.py | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index fb45a06f69..bfa68e9706 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -222,40 +222,6 @@ def create_env(system, partition, name): self._systems[sys_name] = system -def ppretty(value, htchar=' ', lfchar='\n', indent=4, current_depth=0): - nlch = lfchar + htchar * indent * (current_depth + 1) - if type(value) is dict: - if value == {}: - return '{}' - items = [ - nlch + repr(key) + ': ' + - ppretty(value[key], htchar, lfchar, indent, current_depth + 1) - for key in value - ] - return '{%s}' % (','.join(items) + lfchar + - htchar * indent * current_depth) - elif type(value) is list: - if value == []: - return '[]' - items = [ - nlch + ppretty(item, htchar, lfchar, indent, current_depth + 1) - for item in value - ] - return '[%s]' % (','.join(items) + lfchar + - htchar * indent * current_depth) - elif type(value) is tuple: - if value == (): - return '()' - items = [ - nlch + ppretty(item, htchar, lfchar, indent, current_depth + 1) - for item in value - ] - return '(%s)' % (','.join(items) + lfchar + - htchar * indent * current_depth) - else: - return repr(value) - - def convert_old_config(filename): old_config = load_settings_from_file(filename) converted = { @@ -330,7 +296,7 @@ def convert_old_config(filename): converted['modes'].append(new_mode) - def update_config(log_name, original_log): + def update_logging_config(log_name, original_log): new_handlers = [] for h in original_log['handlers']: new_h = h @@ -344,8 +310,8 @@ def update_config(log_name, original_log): } ) - update_config('logging', old_config.logging_config) - update_config('perf_logging', old_config.perf_logging_config) + update_logging_config('logging', old_config.logging_config) + update_logging_config('perf_logging', old_config.perf_logging_config) converted['general'] = [{}] if hasattr(old_config, 'checks_path'): converted['general'][0][ @@ -361,10 +327,8 @@ def update_config(log_name, original_log): del converted['general'] with tempfile.NamedTemporaryFile(mode='w', delete=False) as fp: - fp.write('#\n# This file was automatically generated ' - 'by ReFrame based on `{}\'.\n#\n\n'.format(filename)) - fp.write('site_configuration = ') - fp.write(ppretty(converted)) - fp.write('\n') + fp.write(f"#\n# This file was automatically generated " + f"by ReFrame based on `{filename}'.\n#\n\n") + fp.write(f'site_configuration = {util.ppretty(converted)}\n') return fp.name diff --git a/reframe/utility/__init__.py b/reframe/utility/__init__.py index 30acf3f144..5dbe762eff 100644 --- a/reframe/utility/__init__.py +++ b/reframe/utility/__init__.py @@ -113,6 +113,51 @@ def toalphanum(s): return re.sub(r'\W', '_', s) +def ppretty(value, htchar=' ', lfchar='\n', ind=4, basic_offset=0): + '''Returns a formatted string of dictionaries, lists and tuples + + Arguments: + value -- the value to be formatted + htchar -- horizontal-tab character + lfchar -- linefeed character + ind -- number of htchar characters for every indentation level + basic_offset -- basic offset for the representation''' + nlch = lfchar + htchar * ind * (basic_offset + 1) + if isinstance(value, tuple): + if value == (): + return '()' + + items = [ + nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) + for item in value + ] + return '(%r)' % (','.join(items) + lfchar + + htchar * ind * basic_offset) + elif isinstance(value, collections.abc.Sequence): + if value == []: + return '[]' + + items = [ + nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) + for item in value + ] + return '[%r]' % (','.join(items) + lfchar + + htchar * ind * basic_offset) + elif isinstance(value, collections.abc.Mapping): + if value == {}: + return '{}' + + items = [ + nlch + repr(key) + ': ' + + ppretty(value[key], htchar, lfchar, ind, basic_offset + 1) + for key in value + ] + return '{%r}' % (','.join(items) + lfchar + + htchar * ind * basic_offset) + else: + return repr(value) + + class ScopedDict(UserDict): '''This is a special dict that imposes scopes on its keys. From 4907255e7c4e532d1ed9321940582151b23247f2 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Fri, 13 Mar 2020 12:46:34 +0100 Subject: [PATCH 12/23] Add a stand-alone tool for converting configuration files --- tools/convert_config.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/convert_config.py diff --git a/tools/convert_config.py b/tools/convert_config.py new file mode 100644 index 0000000000..d073a44214 --- /dev/null +++ b/tools/convert_config.py @@ -0,0 +1,27 @@ +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) + +import reframe.core.config as config # noqa: F401, F403 + + +if __name__ == '__main__': + try: + old_config = sys.argv[1] + except IndexError: + print(f'{sys.argv[0]}: too few arguments', file=sys.stderr) + print(f'Usage: {sys.argv[0]} OLD_CONFIG_FILE', file=sys.stderr) + sys.exit(1) + + try: + new_config = config.convert_old_config(old_config) + except Exception as e: + print(f'{sys.argv[0]}: could not convert file: {e}', + file=sys.stderr) + sys.exit(1) + + print( + f"Conversion successful! " + f"Please find the converted file at '{new_config}'." + ) From 4e926e4bf2fc4fc0cab9fb46d7461d21cd5d1e4f Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Fri, 13 Mar 2020 13:39:06 +0100 Subject: [PATCH 13/23] Add copyright notice --- tools/convert_config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/convert_config.py b/tools/convert_config.py index d073a44214..397b3dba6b 100644 --- a/tools/convert_config.py +++ b/tools/convert_config.py @@ -1,3 +1,8 @@ +# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich) +# ReFrame Project Developers. See the top-level LICENSE file for details. +# +# SPDX-License-Identifier: BSD-3-Clause + import os import sys From 74ce4d706c77d7ec3557630b730a44daea344dea Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Fri, 13 Mar 2020 14:07:22 +0100 Subject: [PATCH 14/23] Validate the converted configuration file --- reframe/core/config.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reframe/core/config.py b/reframe/core/config.py index fb45a06f69..410a6a2dc7 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -1,8 +1,11 @@ import collections.abc import json +import jsonschema +import os import re import tempfile +import reframe import reframe.core.debug as debug import reframe.core.fields as fields import reframe.utility as util @@ -360,6 +363,15 @@ def update_config(log_name, original_log): if converted['general'] == [{}]: del converted['general'] + # Validate the converted file + schema_filename = os.path.join(reframe.INSTALL_PREFIX, + 'schemas', 'config.json') + + # We let the following statements raise, because if they do, that's a BUG + with open(schema_filename) as fp: + schema = json.loads(fp.read()) + + jsonschema.validate(converted, schema) with tempfile.NamedTemporaryFile(mode='w', delete=False) as fp: fp.write('#\n# This file was automatically generated ' 'by ReFrame based on `{}\'.\n#\n\n'.format(filename)) From 879a7ce139cca1028cc578f5bff8733cd24cf88a Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Fri, 13 Mar 2020 16:32:38 +0100 Subject: [PATCH 15/23] Fix ppretty --- reframe/utility/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reframe/utility/__init__.py b/reframe/utility/__init__.py index bb496cbda6..7981979390 100644 --- a/reframe/utility/__init__.py +++ b/reframe/utility/__init__.py @@ -144,9 +144,9 @@ def ppretty(value, htchar=' ', lfchar='\n', ind=4, basic_offset=0): nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) for item in value ] - return '(%r)' % (','.join(items) + lfchar + + return '(%s)' % (','.join(items) + lfchar + htchar * ind * basic_offset) - elif isinstance(value, collections.abc.Sequence): + elif isinstance(value, list): if value == []: return '[]' @@ -154,9 +154,9 @@ def ppretty(value, htchar=' ', lfchar='\n', ind=4, basic_offset=0): nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) for item in value ] - return '[%r]' % (','.join(items) + lfchar + + return '[%s]' % (','.join(items) + lfchar + htchar * ind * basic_offset) - elif isinstance(value, collections.abc.Mapping): + elif isinstance(value, dict): if value == {}: return '{}' @@ -165,7 +165,7 @@ def ppretty(value, htchar=' ', lfchar='\n', ind=4, basic_offset=0): ppretty(value[key], htchar, lfchar, ind, basic_offset + 1) for key in value ] - return '{%r}' % (','.join(items) + lfchar + + return '{%s}' % (','.join(items) + lfchar + htchar * ind * basic_offset) else: return repr(value) From 9e634ce5a3764f5497f34fb14e22326c1572f763 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Fri, 13 Mar 2020 18:30:55 +0100 Subject: [PATCH 16/23] Fix convert_old_config - Fix container platform handling - Fix variables in environments - Delete type attribute from environments --- reframe/core/config.py | 23 +++++++++++++++++++++++ schemas/config.json | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index 35bec26fb0..c681f6e312 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -279,6 +279,18 @@ def convert_old_config(filename): [vname, v] for vname, v in p['variables'].items() ] + if 'container_platforms' in p: + new_p['container_platforms'] = [] + for cname, c in p['container_platforms'].items(): + new_c = {'name': cname} + new_c.update(c) + if 'variables' in c: + new_c['variables'] = [ + [vn, v] for vn, v in c['variables'].items() + ] + + new_p['container_platforms'].append(new_c) + sys_dict['partitions'].append(new_p) converted['systems'].append(sys_dict) @@ -291,6 +303,17 @@ def convert_old_config(filename): new_env['target_systems'] = [env_target] new_env.update(e) + + # Make variables dictionary into a list of lists + if 'variables' in e: + new_env['variables'] = [ + [vname, v] for vname, v in e['variables'].items() + ] + + # Type attribute has been deprecated + if 'type' in new_env: + del new_env['type'] + converted['environments'].append(new_env) if 'modes' in old_config.site_configuration: diff --git a/schemas/config.json b/schemas/config.json index 34c4bcd1ee..6378f2232d 100644 --- a/schemas/config.json +++ b/schemas/config.json @@ -147,7 +147,7 @@ "descr": {"type": "string"}, "scheduler": { "type": "string", - "enum": ["local", "pbs", "slurm", "squeue"] + "enum": ["local", "pbs", "slurm", "squeue", "torque"] }, "launcher": { "type": "string", From 41b7ef23ea380db94634c4fc61aada3a848af41f Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Fri, 13 Mar 2020 19:51:01 +0100 Subject: [PATCH 17/23] Add unittests for ppretty --- reframe/utility/__init__.py | 10 ++++++++ unittests/test_utility.py | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/reframe/utility/__init__.py b/reframe/utility/__init__.py index 7981979390..d494cfce31 100644 --- a/reframe/utility/__init__.py +++ b/reframe/utility/__init__.py @@ -167,6 +167,16 @@ def ppretty(value, htchar=' ', lfchar='\n', ind=4, basic_offset=0): ] return '{%s}' % (','.join(items) + lfchar + htchar * ind * basic_offset) + elif isinstance(value, set): + if value == set(): + return 'set()' + + items = [ + nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) + for item in value + ] + return '{%s}' % (','.join(items) + lfchar + + htchar * ind * basic_offset) else: return repr(value) diff --git a/unittests/test_utility.py b/unittests/test_utility.py index eeb148dd25..754b5e9406 100644 --- a/unittests/test_utility.py +++ b/unittests/test_utility.py @@ -444,6 +444,54 @@ def __repr__(self): assert 'D(...)' in rep +class TestUtilPpretty(unittest.TestCase): + def test_simple_types(self): + assert util.ppretty(1) == debug.repr(1) + assert util.ppretty(1.2) == debug.repr(1.2) + assert util.ppretty([]) == '[]' + assert util.ppretty(()) == '()' + assert util.ppretty(set()) == 'set()' + assert util.ppretty({}) == '{}' + assert util.ppretty([1, 2, 3]) == '[\n 1,\n 2,\n 3\n]' + assert util.ppretty((1, 2, 3)) == '(\n 1,\n 2,\n 3\n)' + assert util.ppretty({1, 2, 3}) == '{\n 1,\n 2,\n 3\n}' + assert util.ppretty({'a': 1, 'b': 2}) == ("{\n" + " 'a': 1,\n" + " 'b': 2\n" + "}") + + def test_mixed_types(self): + assert util.ppretty({'a': 1, 'b': (2, 3)}) == ("{\n" + " 'a': 1,\n" + " 'b': (\n" + " 2,\n" + " 3\n" + " )\n" + "}") + assert ( + util.ppretty({'a': 2, 34: (2, 3), + 'b': [[], [1.2, 3.4], {1, 2}]}) == + "{\n" + " 'a': 2,\n" + " 34: (\n" + " 2,\n" + " 3\n" + " ),\n" + " 'b': [\n" + " [],\n" + " [\n" + " 1.2,\n" + " 3.4\n" + " ],\n" + " {\n" + " 1,\n" + " 2\n" + " }\n" + " ]\n" + "}" + ) + + class TestChangeDirCtxManager(unittest.TestCase): def setUp(self): self.temp_dir = tempfile.mkdtemp() From a4214146c98c47b414af159ad3714e6ab1b9c224 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Tue, 17 Mar 2020 19:09:52 +0100 Subject: [PATCH 18/23] Fix ppretty docstring --- reframe/utility/__init__.py | 39 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/reframe/utility/__init__.py b/reframe/utility/__init__.py index d494cfce31..b16a0632ca 100644 --- a/reframe/utility/__init__.py +++ b/reframe/utility/__init__.py @@ -126,57 +126,60 @@ def toalphanum(s): return re.sub(r'\W', '_', s) -def ppretty(value, htchar=' ', lfchar='\n', ind=4, basic_offset=0): - '''Returns a formatted string of dictionaries, lists and tuples - - Arguments: - value -- the value to be formatted - htchar -- horizontal-tab character - lfchar -- linefeed character - ind -- number of htchar characters for every indentation level - basic_offset -- basic offset for the representation''' - nlch = lfchar + htchar * ind * (basic_offset + 1) +def ppretty(value, htchar=' ', lfchar='\n', indent=4, basic_offset=0): + '''Format string of dictionaries, lists and tuples + + :arg value: The value to be formatted. + :arg htchar: Horizontal-tab character. + :arg lfchar: Linefeed character. + :arg indent: Number of htchar characters for every indentation level. + :arg basic_offset: Basic offset for the representation, any additional + indentation space is added to the ``basic_offset``. + :returns: a formatted string of the ``value``. + ''' + + nlch = lfchar + htchar * indent * (basic_offset + 1) if isinstance(value, tuple): if value == (): return '()' items = [ - nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) + nlch + ppretty(item, htchar, lfchar, indent, basic_offset + 1) for item in value ] return '(%s)' % (','.join(items) + lfchar + - htchar * ind * basic_offset) + htchar * indent * basic_offset) elif isinstance(value, list): if value == []: return '[]' items = [ - nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) + nlch + ppretty(item, htchar, lfchar, indent, basic_offset + 1) for item in value ] return '[%s]' % (','.join(items) + lfchar + - htchar * ind * basic_offset) + htchar * indent * basic_offset) elif isinstance(value, dict): if value == {}: return '{}' items = [ nlch + repr(key) + ': ' + - ppretty(value[key], htchar, lfchar, ind, basic_offset + 1) + ppretty(value[key], htchar, lfchar, indent, basic_offset + 1) for key in value ] return '{%s}' % (','.join(items) + lfchar + - htchar * ind * basic_offset) + htchar * indent * basic_offset) elif isinstance(value, set): if value == set(): return 'set()' items = [ - nlch + ppretty(item, htchar, lfchar, ind, basic_offset + 1) + nlch + ppretty(item, htchar, lfchar, indent, basic_offset + 1) for item in value ] return '{%s}' % (','.join(items) + lfchar + - htchar * ind * basic_offset) + htchar * indent * basic_offset) else: return repr(value) From 1dbbb5fbe4a11fc40c7b9584d54716530ed431c0 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Tue, 17 Mar 2020 19:13:22 +0100 Subject: [PATCH 19/23] Add more unittests for ppretty --- unittests/test_utility.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/unittests/test_utility.py b/unittests/test_utility.py index 754b5e9406..52d96a035a 100644 --- a/unittests/test_utility.py +++ b/unittests/test_utility.py @@ -444,10 +444,11 @@ def __repr__(self): assert 'D(...)' in rep -class TestUtilPpretty(unittest.TestCase): +class TestPpretty: def test_simple_types(self): - assert util.ppretty(1) == debug.repr(1) - assert util.ppretty(1.2) == debug.repr(1.2) + assert util.ppretty(1) == repr(1) + assert util.ppretty(1.2) == repr(1.2) + assert util.ppretty('a string') == repr('a string') assert util.ppretty([]) == '[]' assert util.ppretty(()) == '()' assert util.ppretty(set()) == 'set()' @@ -461,6 +462,14 @@ def test_simple_types(self): "}") def test_mixed_types(self): + assert ( + util.ppretty(['a string', 2, 'another string']) == + "[\n" + " 'a string',\n" + " 2,\n" + " 'another string'\n" + "]" + ) assert util.ppretty({'a': 1, 'b': (2, 3)}) == ("{\n" " 'a': 1,\n" " 'b': (\n" From d2bd624fb28b56a4f98bc2ba122d02c5a5c808f9 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Tue, 17 Mar 2020 19:15:09 +0100 Subject: [PATCH 20/23] Minor fixes in config.py --- reframe/core/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reframe/core/config.py b/reframe/core/config.py index c681f6e312..69eb8001ee 100644 --- a/reframe/core/config.py +++ b/reframe/core/config.py @@ -304,13 +304,13 @@ def convert_old_config(filename): new_env.update(e) - # Make variables dictionary into a list of lists + # Convert variables dictionary to a list of lists if 'variables' in e: new_env['variables'] = [ [vname, v] for vname, v in e['variables'].items() ] - # Type attribute has been deprecated + # Type attribute is not used anymore if 'type' in new_env: del new_env['type'] @@ -368,7 +368,7 @@ def update_logging_config(log_name, original_log): jsonschema.validate(converted, schema) with tempfile.NamedTemporaryFile(mode='w', delete=False) as fp: fp.write(f"#\n# This file was automatically generated " - f"by ReFrame based on `{filename}'.\n#\n\n") + f"by ReFrame based on '{filename}'.\n#\n\n") fp.write(f'site_configuration = {util.ppretty(converted)}\n') return fp.name From 22e34903db765f0f83c856bb3bf22593185029f9 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 18 Mar 2020 09:06:31 +0100 Subject: [PATCH 21/23] Add nested dictionary and custom repr unittests --- unittests/test_utility.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/unittests/test_utility.py b/unittests/test_utility.py index 52d96a035a..ef32f39267 100644 --- a/unittests/test_utility.py +++ b/unittests/test_utility.py @@ -477,6 +477,18 @@ def test_mixed_types(self): " 3\n" " )\n" "}") + assert ( + util.ppretty({'a': 1, 'b': {2: {3: 4, 5: {}}}, 'c': 6}) == + "{\n" + " 'a': 1,\n" + " 'b': {\n" + " 2: {\n" + " 3: 4,\n" + " 5: {}\n" + " }\n" + " },\n" + " 'c': 6\n" + "}") assert ( util.ppretty({'a': 2, 34: (2, 3), 'b': [[], [1.2, 3.4], {1, 2}]}) == @@ -500,6 +512,26 @@ def test_mixed_types(self): "}" ) + def test_obj_print(self): + class C: + def __repr__(self): + return '' + + class D: + def __repr__(self): + return '' + + c = C() + d = D() + + assert util.ppretty(c) == 'class C' + assert util.ppretty(['a', 'b', c, d]) == ("[\n" + " 'a',\n" + " 'b',\n" + " ,\n" + " \n" + "]") + class TestChangeDirCtxManager(unittest.TestCase): def setUp(self): From 74a5efc504b552b8de6dde1dbf90464690b2bb64 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Wed, 18 Mar 2020 10:47:10 +0100 Subject: [PATCH 22/23] Fix unittest for class pprint --- unittests/test_utility.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unittests/test_utility.py b/unittests/test_utility.py index ef32f39267..a936468fd8 100644 --- a/unittests/test_utility.py +++ b/unittests/test_utility.py @@ -523,8 +523,7 @@ def __repr__(self): c = C() d = D() - - assert util.ppretty(c) == 'class C' + assert util.ppretty(c) == '' assert util.ppretty(['a', 'b', c, d]) == ("[\n" " 'a',\n" " 'b',\n" From 7599c2482b424cdbcf5014750bdd49ff5fd234cb Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Mon, 23 Mar 2020 17:16:04 +0100 Subject: [PATCH 23/23] Always install ReFrame's requirements in CI --- ci-scripts/ci-runner.bash | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci-scripts/ci-runner.bash b/ci-scripts/ci-runner.bash index 805d69f6b4..5cc5d8c33e 100644 --- a/ci-scripts/ci-runner.bash +++ b/ci-scripts/ci-runner.bash @@ -137,13 +137,15 @@ fi if [[ $(hostname) =~ tsa ]]; then # FIXME: Temporary workaround until we have a reframe module on Tsa module load python - python3 -m venv venv.unittests - source venv.unittests/bin/activate - pip install -r requirements.txt else module load reframe fi +# Always install our requirements +python3 -m venv venv.unittests +source venv.unittests/bin/activate +pip install -r requirements.txt + echo "==============" echo "Loaded Modules" echo "=============="