Skip to content

Commit 6c1e282

Browse files
committed
Use a set to avoid duplicates
1 parent abd6b97 commit 6c1e282

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

osg_configure/modules/ce_attributes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,34 @@ def get_resource_group_from_config(config: ConfigParser) -> str:
3838

3939

4040
def get_batch_systems_from_config(config: ConfigParser) -> str:
41-
batch_systems = []
41+
batch_systems = set()
4242

4343
siteinfo_batch_systems = config.get("Site Information", "batch_systems", fallback=None)
4444
if siteinfo_batch_systems is not None:
4545
# Site Information.batch_systems specified -- this one wins
4646
split_batch_systems = utilities.split_comma_separated_list(siteinfo_batch_systems)
4747
for batch_system in split_batch_systems:
4848
try:
49-
batch_systems.append(BATCH_SYSTEMS_CASE_MAP[batch_system.lower()])
49+
batch_systems.add(BATCH_SYSTEMS_CASE_MAP[batch_system.lower()])
5050
except KeyError:
5151
raise SettingError("Unrecognized batch system %s" % batch_system)
5252
else:
5353
# Add each batch system that's enabled from the sections in the 20-*.ini files.
5454
for batch_system in BATCH_SYSTEMS:
5555
if batch_system in config:
5656
if config.getboolean(section=batch_system, option="enabled", fallback=None):
57-
batch_systems.append(batch_system)
57+
batch_systems.add(batch_system)
5858

5959
# Special case: BOSCO (see SOFTWARE-3720); use the BOSCO.batch argument.
6060
if config.getboolean("BOSCO", "enabled", fallback=False):
6161
bosco_batch = config.get("BOSCO", "batch", fallback=None)
6262
if bosco_batch:
6363
try:
64-
batch_systems.append(BATCH_SYSTEMS_CASE_MAP[bosco_batch.lower()])
64+
batch_systems.add(BATCH_SYSTEMS_CASE_MAP[bosco_batch.lower()])
6565
except KeyError:
6666
raise SettingError("Unrecognized batch system %s in Bosco section" % bosco_batch)
6767

68-
return utilities.classad_quote(",".join(batch_systems))
68+
return utilities.classad_quote(",".join(sorted(batch_systems)))
6969

7070

7171
def get_resource_catalog_from_config(config: ConfigParser) -> str:

0 commit comments

Comments
 (0)