@@ -2199,30 +2199,31 @@ def test_parallel(self):
2199
2199
toy_ec = os .path .join (topdir , 'easyconfigs' , 'test_ecs' , 't' , 'toy' , 'toy-0.0.eb' )
2200
2200
toytxt = read_file (toy_ec )
2201
2201
2202
+ handle , toy_ec_error = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2203
+ os .close (handle )
2204
+ write_file (toy_ec_error , toytxt + "\n parallel = 123" )
2205
+
2202
2206
handle , toy_ec1 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2203
2207
os .close (handle )
2204
- write_file (toy_ec1 , toytxt + "\n parallel = 13 " )
2208
+ write_file (toy_ec1 , toytxt + "\n maxparallel = None " )
2205
2209
2206
2210
handle , toy_ec2 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2207
2211
os .close (handle )
2208
- write_file (toy_ec2 , toytxt + "\n parallel = 12 \ n maxparallel = 6" )
2212
+ write_file (toy_ec2 , toytxt + "\n maxparallel = 6" )
2209
2213
2210
2214
handle , toy_ec3 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2211
2215
os .close (handle )
2212
- write_file (toy_ec3 , toytxt + "\n parallel = False" )
2213
-
2214
- handle , toy_ec4 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2215
- os .close (handle )
2216
- write_file (toy_ec4 , toytxt + "\n maxparallel = 6" )
2217
-
2218
- handle , toy_ec5 = tempfile .mkstemp (prefix = 'easyblock_test_file_' , suffix = '.eb' )
2219
- os .close (handle )
2220
- write_file (toy_ec5 , toytxt + "\n maxparallel = False" )
2216
+ write_file (toy_ec3 , toytxt + "\n maxparallel = False" )
2221
2217
2222
2218
import easybuild .tools .systemtools as st
2223
2219
auto_parallel = 15
2224
2220
st .det_parallelism ._default_parallelism = auto_parallel
2225
2221
2222
+ # 'parallel' easyconfig parameter specified is an error
2223
+ self .assertRaises (EasyBuildError , EasyConfig , toy_ec_error )
2224
+ self .assertErrorRegex (EasyBuildError , "Easyconfig parameter 'parallel' is replaced by 'maxparallel'" ,
2225
+ EasyConfig , toy_ec_error )
2226
+
2226
2227
# default: parallelism is derived from # available cores + ulimit
2227
2228
# Note that maxparallel has a default of 16, so we need a lower auto_paralle value here
2228
2229
test_eb = EasyBlock (EasyConfig (toy_ec ))
@@ -2232,87 +2233,36 @@ def test_parallel(self):
2232
2233
auto_parallel = 128 # Don't limit by available CPU cores mock
2233
2234
st .det_parallelism ._default_parallelism = auto_parallel
2234
2235
2235
- # only 'parallel' easyconfig parameter specified (no 'parallel' build option)
2236
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2237
- test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2238
- test_eb .check_readiness_step ()
2239
- self .assertEqual (test_eb .cfg .parallel , 13 )
2240
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2241
- self .assertEqual (test_eb .cfg ['parallel' ], 13 )
2242
-
2243
- # both 'parallel' and 'maxparallel' easyconfig parameters specified (no 'parallel' build option)
2244
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2245
- test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2246
- test_eb .check_readiness_step ()
2247
- self .assertEqual (test_eb .cfg .parallel , 6 )
2248
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2249
- self .assertEqual (test_eb .cfg ['parallel' ], 6 )
2250
-
2251
- # make sure 'parallel = False' is not overriden (no 'parallel' build option)
2252
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2253
- test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2254
- test_eb .check_readiness_step ()
2255
- self .assertEqual (test_eb .cfg .parallel , False )
2256
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2257
- self .assertEqual (test_eb .cfg ['parallel' ], False )
2258
-
2259
2236
# only 'maxparallel' easyconfig parameter specified (no 'parallel' build option)
2260
- test_eb = EasyBlock (EasyConfig (toy_ec4 ))
2237
+ test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2261
2238
test_eb .check_readiness_step ()
2262
2239
self .assertEqual (test_eb .cfg .parallel , 6 )
2263
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2264
- self .assertEqual (test_eb .cfg ['parallel' ], 6 )
2265
2240
2266
2241
# make sure 'maxparallel = False' is treated as 1 (no 'parallel' build option)
2267
- test_eb = EasyBlock (EasyConfig (toy_ec5 ))
2242
+ test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2268
2243
test_eb .check_readiness_step ()
2269
2244
self .assertEqual (test_eb .cfg .parallel , 1 )
2270
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2271
- self .assertEqual (test_eb .cfg ['parallel' ], 1 )
2272
2245
2273
2246
# only 'parallel' build option specified
2274
2247
init_config (build_options = {'parallel' : '13' , 'validate' : False })
2275
2248
test_eb = EasyBlock (EasyConfig (toy_ec ))
2276
2249
test_eb .check_readiness_step ()
2277
2250
self .assertEqual (test_eb .cfg .parallel , 13 )
2278
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2279
- self .assertEqual (test_eb .cfg ['parallel' ], 13 )
2280
2251
2281
- # both 'parallel' build option and easyconfig parameter specified (no 'maxparallel')
2282
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2283
- test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2252
+ # 'maxparallel = None' is the same as unset
2253
+ test_eb = EasyBlock (EasyConfig (toy_ec1 ))
2284
2254
test_eb .check_readiness_step ()
2285
2255
self .assertEqual (test_eb .cfg .parallel , 13 )
2286
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2287
- self .assertEqual (test_eb .cfg ['parallel' ], 13 )
2288
-
2289
- # both 'parallel' and 'maxparallel' easyconfig parameters specified + 'parallel' build option
2290
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2291
- test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2292
- test_eb .check_readiness_step ()
2293
- self .assertEqual (test_eb .cfg .parallel , 6 )
2294
-
2295
- # make sure 'parallel = False' is not overriden (with 'parallel' build option)
2296
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2297
- test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2298
- test_eb .check_readiness_step ()
2299
- self .assertEqual (test_eb .cfg .parallel , 0 )
2300
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2301
- self .assertEqual (test_eb .cfg ['parallel' ], 0 )
2302
2256
2303
- # only 'maxparallel' easyconfig parameter specified ( with 'parallel' build option)
2304
- test_eb = EasyBlock (EasyConfig (toy_ec4 ))
2257
+ # 'maxparallel' easyconfig parameter with 'parallel' build option
2258
+ test_eb = EasyBlock (EasyConfig (toy_ec2 ))
2305
2259
test_eb .check_readiness_step ()
2306
2260
self .assertEqual (test_eb .cfg .parallel , 6 )
2307
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2308
- self .assertEqual (test_eb .cfg ['parallel' ], 6 )
2309
2261
2310
2262
# make sure 'maxparallel = False' is treated as 1 (with 'parallel' build option)
2311
- test_eb = EasyBlock (EasyConfig (toy_ec5 ))
2263
+ test_eb = EasyBlock (EasyConfig (toy_ec3 ))
2312
2264
test_eb .check_readiness_step ()
2313
2265
self .assertEqual (test_eb .cfg .parallel , 1 )
2314
- with self .temporarily_allow_deprecated_behaviour (), self .mocked_stdout_stderr ():
2315
- self .assertEqual (test_eb .cfg ['parallel' ], 1 )
2316
2266
2317
2267
# Template updated correctly
2318
2268
test_eb .cfg ['buildopts' ] = '-j %(parallel)s'
0 commit comments