Skip to content

Commit af62d8e

Browse files
committed
Remove _parallelLegacy
1 parent 3484638 commit af62d8e

File tree

4 files changed

+30
-95
lines changed

4 files changed

+30
-95
lines changed

easybuild/framework/easyblock.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,16 +2251,6 @@ def set_parallel(self):
22512251
if par is not None:
22522252
self.log.debug("Desired parallelism specified via 'parallel' build option: %s", par)
22532253

2254-
# Transitional only in case some easyblocks still set/change cfg['parallel']
2255-
# Use _parallelLegacy to avoid deprecation warnings
2256-
# Remove for EasyBuild 5.0
2257-
cfg_par = self.cfg['_parallelLegacy']
2258-
if cfg_par is not None:
2259-
if par is None:
2260-
par = cfg_par
2261-
else:
2262-
par = min(int(par), int(cfg_par))
2263-
22642254
par = det_parallelism(par, maxpar=self.cfg['maxparallel'])
22652255
self.log.info("Setting parallelism: %s" % par)
22662256
self.cfg.parallel = par

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def new_ec_method(self, key, *args, **kwargs):
132132
key, ver = DEPRECATED_EASYCONFIG_PARAMETERS[depr_key]
133133
_log.deprecated("Easyconfig parameter '%s' is deprecated, use '%s' instead" % (depr_key, key), ver)
134134
elif key in REPLACED_PARAMETERS:
135-
_log.nosupport("Easyconfig parameter '%s' is replaced by '%s'" % (key, REPLACED_PARAMETERS[key]), '2.0')
135+
newkey, ver = REPLACED_PARAMETERS[key]
136+
_log.nosupport("Easyconfig parameter '%s' is replaced by '%s'" % (key, newkey), ver)
136137
return ec_method(self, key, *args, **kwargs)
137138

138139
return new_ec_method
@@ -149,9 +150,7 @@ def is_local_var_name(name):
149150
"""
150151
res = False
151152
if name.startswith(LOCAL_VAR_PREFIX) or name.startswith('_'):
152-
# Remove with EasyBuild 5.0
153-
if name != '_parallelLegacy':
154-
res = True
153+
res = True
155154
# __builtins__ is always defined as a 'local' variables
156155
# single-letter local variable names are allowed (mainly for use in list comprehensions)
157156
# in Python 2, variables defined in list comprehensions leak to the outside (no longer the case in Python 3)
@@ -506,8 +505,6 @@ def __init__(self, path, extra_options=None, build_specs=None, validate=True, hi
506505

507506
# Storage for parallel property. Mark as unset initially
508507
self._parallel = None
509-
# Legacy value, remove with EasyBuild 5.0
510-
self._config['_parallelLegacy'] = [None, '', ('', )]
511508

512509
# parse easyconfig file
513510
self.build_specs = build_specs
@@ -709,11 +706,6 @@ def parse(self):
709706
if missing_mandatory_keys:
710707
raise EasyBuildError("mandatory parameters not provided in %s: %s", self.path, missing_mandatory_keys)
711708

712-
if 'parallel' in ec_vars:
713-
# Replace value and issue better warning for EC params (as opposed to warnings meant for easyblocks)
714-
self.log.deprecated("Easyconfig parameter 'parallel' is deprecated, use 'maxparallel' instead.", '5.0')
715-
ec_vars['_parallelLegacy'] = ec_vars.pop('parallel')
716-
717709
# provide suggestions for typos. Local variable names are excluded from this check
718710
possible_typos = [(key, difflib.get_close_matches(key.lower(), self._config.keys(), 1, 0.85))
719711
for key in ec_vars if not is_local_var_name(key) and key not in self]
@@ -1233,8 +1225,6 @@ def parallel(self, value):
12331225
# Update backstorage and template value
12341226
self._parallel = value
12351227
self.template_values['parallel'] = value
1236-
# Backwards compat only. Remove with EasyBuild 5.0
1237-
self._config['_parallelLegacy'][0] = value
12381228

12391229
def dump(self, fp, always_overwrite=True, backup=False, explicit_toolchains=False):
12401230
"""

easybuild/framework/easyconfig/parser.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@
107107

108108
# replaced easyconfig parameters, and their replacements
109109
REPLACED_PARAMETERS = {
110-
'license': 'license_file',
111-
'makeopts': 'buildopts',
112-
'premakeopts': 'prebuildopts',
110+
# <old_param>: (<new_param>, <removed_in_version>),
111+
'license': ('license_file', '2.0'),
112+
'makeopts': ('buildopts', '2.0'),
113+
'parallel': ('maxparallel', '5.0'),
114+
'premakeopts': ('prebuildopts', '2.0'),
113115
}
114116

115117
_log = fancylogger.getLogger('easyconfig.parser', fname=False)

test/framework/easyblock.py

Lines changed: 22 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,118 +2182,71 @@ def test_parallel(self):
21822182
toy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0.eb')
21832183
toytxt = read_file(toy_ec)
21842184

2185+
handle, toy_ec_error = tempfile.mkstemp(prefix='easyblock_test_file_', suffix='.eb')
2186+
os.close(handle)
2187+
write_file(toy_ec_error, toytxt + "\nparallel = 123")
2188+
21852189
handle, toy_ec1 = tempfile.mkstemp(prefix='easyblock_test_file_', suffix='.eb')
21862190
os.close(handle)
2187-
write_file(toy_ec1, toytxt + "\nparallel = 123")
2191+
write_file(toy_ec1, toytxt + "\nmaxparallel = None")
21882192

21892193
handle, toy_ec2 = tempfile.mkstemp(prefix='easyblock_test_file_', suffix='.eb')
21902194
os.close(handle)
2191-
write_file(toy_ec2, toytxt + "\nparallel = 123\nmaxparallel = 67")
2195+
write_file(toy_ec2, toytxt + "\nmaxparallel = 67")
21922196

21932197
handle, toy_ec3 = tempfile.mkstemp(prefix='easyblock_test_file_', suffix='.eb')
21942198
os.close(handle)
2195-
write_file(toy_ec3, toytxt + "\nparallel = False")
2196-
2197-
handle, toy_ec4 = tempfile.mkstemp(prefix='easyblock_test_file_', suffix='.eb')
2198-
os.close(handle)
2199-
write_file(toy_ec4, toytxt + "\nmaxparallel = 67")
2200-
2201-
handle, toy_ec5 = tempfile.mkstemp(prefix='easyblock_test_file_', suffix='.eb')
2202-
os.close(handle)
2203-
write_file(toy_ec5, toytxt + "\nmaxparallel = False")
2199+
write_file(toy_ec3, toytxt + "\nmaxparallel = False")
22042200

22052201
import easybuild.tools.systemtools as st
22062202
auto_parallel = 1337
22072203
st.det_parallelism._default_parallelism = auto_parallel
22082204

2205+
# 'parallel' easyconfig parameter specified is an error
2206+
self.assertRaises(EasyBuildError, EasyConfig, toy_ec_error)
2207+
self.assertErrorRegex(EasyBuildError, "Easyconfig parameter 'parallel' is replaced by 'maxparallel'",
2208+
EasyConfig, toy_ec_error)
2209+
22092210
# default: parallelism is derived from # available cores + ulimit
22102211
test_eb = EasyBlock(EasyConfig(toy_ec))
22112212
test_eb.check_readiness_step()
22122213
self.assertEqual(test_eb.cfg.parallel, auto_parallel)
22132214

2214-
# only 'parallel' easyconfig parameter specified (no 'parallel' build option)
2215-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2216-
test_eb = EasyBlock(EasyConfig(toy_ec1))
2217-
test_eb.check_readiness_step()
2218-
self.assertEqual(test_eb.cfg.parallel, 123)
2219-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2220-
self.assertEqual(test_eb.cfg['parallel'], 123)
2221-
2222-
# both 'parallel' and 'maxparallel' easyconfig parameters specified (no 'parallel' build option)
2223-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2224-
test_eb = EasyBlock(EasyConfig(toy_ec2))
2215+
# 'maxparallel = None' is the same as unset
2216+
test_eb = EasyBlock(EasyConfig(toy_ec1))
22252217
test_eb.check_readiness_step()
2226-
self.assertEqual(test_eb.cfg.parallel, 67)
2227-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2228-
self.assertEqual(test_eb.cfg['parallel'], 67)
2229-
2230-
# make sure 'parallel = False' is not overriden (no 'parallel' build option)
2231-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2232-
test_eb = EasyBlock(EasyConfig(toy_ec3))
2233-
test_eb.check_readiness_step()
2234-
self.assertEqual(test_eb.cfg.parallel, False)
2235-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2236-
self.assertEqual(test_eb.cfg['parallel'], False)
2218+
self.assertEqual(test_eb.cfg.parallel, auto_parallel)
22372219

22382220
# only 'maxparallel' easyconfig parameter specified (no 'parallel' build option)
2239-
test_eb = EasyBlock(EasyConfig(toy_ec4))
2221+
test_eb = EasyBlock(EasyConfig(toy_ec2))
22402222
test_eb.check_readiness_step()
22412223
self.assertEqual(test_eb.cfg.parallel, 67)
2242-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2243-
self.assertEqual(test_eb.cfg['parallel'], 67)
22442224

22452225
# make sure 'maxparallel = False' is treated as 1 (no 'parallel' build option)
2246-
test_eb = EasyBlock(EasyConfig(toy_ec5))
2226+
test_eb = EasyBlock(EasyConfig(toy_ec3))
22472227
test_eb.check_readiness_step()
22482228
self.assertEqual(test_eb.cfg.parallel, 1)
2249-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2250-
self.assertEqual(test_eb.cfg['parallel'], 1)
22512229

22522230
# only 'parallel' build option specified
22532231
init_config(build_options={'parallel': '97', 'validate': False})
22542232
test_eb = EasyBlock(EasyConfig(toy_ec))
22552233
test_eb.check_readiness_step()
22562234
self.assertEqual(test_eb.cfg.parallel, 97)
2257-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2258-
self.assertEqual(test_eb.cfg['parallel'], 97)
22592235

2260-
# both 'parallel' build option and easyconfig parameter specified (no 'maxparallel')
2261-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2262-
test_eb = EasyBlock(EasyConfig(toy_ec1))
2236+
# 'maxparallel = None' is the same as unset
2237+
test_eb = EasyBlock(EasyConfig(toy_ec1))
22632238
test_eb.check_readiness_step()
22642239
self.assertEqual(test_eb.cfg.parallel, 97)
2265-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2266-
self.assertEqual(test_eb.cfg['parallel'], 97)
2267-
2268-
# both 'parallel' and 'maxparallel' easyconfig parameters specified + 'parallel' build option
2269-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2270-
test_eb = EasyBlock(EasyConfig(toy_ec2))
2271-
test_eb.check_readiness_step()
2272-
self.assertEqual(test_eb.cfg.parallel, 67)
2273-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2274-
self.assertEqual(test_eb.cfg['parallel'], 67)
2275-
2276-
# make sure 'parallel = False' is not overriden (with 'parallel' build option)
2277-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2278-
test_eb = EasyBlock(EasyConfig(toy_ec3))
2279-
test_eb.check_readiness_step()
2280-
self.assertEqual(test_eb.cfg.parallel, 0)
2281-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2282-
self.assertEqual(test_eb.cfg['parallel'], 0)
22832240

2284-
# only 'maxparallel' easyconfig parameter specified (with 'parallel' build option)
2285-
test_eb = EasyBlock(EasyConfig(toy_ec4))
2241+
# 'maxparallel' easyconfig parameter with 'parallel' build option
2242+
test_eb = EasyBlock(EasyConfig(toy_ec2))
22862243
test_eb.check_readiness_step()
22872244
self.assertEqual(test_eb.cfg.parallel, 67)
2288-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2289-
self.assertEqual(test_eb.cfg['parallel'], 67)
22902245

22912246
# make sure 'maxparallel = False' is treated as 1 (with 'parallel' build option)
2292-
test_eb = EasyBlock(EasyConfig(toy_ec5))
2247+
test_eb = EasyBlock(EasyConfig(toy_ec3))
22932248
test_eb.check_readiness_step()
22942249
self.assertEqual(test_eb.cfg.parallel, 1)
2295-
with self.temporarily_allow_deprecated_behaviour(), self.mocked_stderr():
2296-
self.assertEqual(test_eb.cfg['parallel'], 1)
22972250

22982251
# Template updated correctly
22992252
test_eb.cfg['buildopts'] = '-j %(parallel)s'

0 commit comments

Comments
 (0)