Skip to content

Commit b80d189

Browse files
committed
HTCONDOR-2688 Remove verify_ce_config checks for old router syntax
1 parent 5e14c56 commit b80d189

File tree

2 files changed

+0
-173
lines changed

2 files changed

+0
-173
lines changed

Diff for: src/verify_ce_config.py

-101
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,6 @@ def debug(msg):
2929
print("DEBUG: " + msg)
3030

3131

32-
def parse_route_names(entries_config):
33-
"""Return names of job routes that can be parsed as proper ClassAds
34-
"""
35-
try:
36-
return [x['Name'] for x in classad.parseAds(entries_config)]
37-
except KeyError:
38-
error("Name is a required field for all entries in JOB_ROUTER_ENTRIES")
39-
40-
41-
def find_malformed_entries(entries_config):
42-
"""Find all unparseable router entries based on the raw JOB_ROUTER_ENTRIES configuration
43-
"""
44-
unparsed_names = [x.replace('"', '')
45-
for x in re.findall(r'''name\s*=\s*["'](\w+)["']''',
46-
entries_config,
47-
re.IGNORECASE)]
48-
parsed_names = parse_route_names(entries_config)
49-
50-
return set(unparsed_names) - set(parsed_names)
51-
52-
5332
# Verify that the HTCondor Python bindings are in the PYTHONPATH
5433
try:
5534
import classad2 as classad
@@ -76,86 +55,6 @@ def main():
7655
if not route_def:
7756
warn(f"The route {name} is specified in JOB_ROUTER_ROUTE_NAMES, but no corresponding JOB_ROUTER_ROUTE_{name} exists")
7857

79-
# If no JOB_ROUTER_ROUTE_<name> rules exist, verify JOB_ROUTER_DEFAULTS and JOB_ROUTER_ENTRIES
80-
else:
81-
used_deprecated_knobs = []
82-
for knob in ['JOB_ROUTER_DEFAULTS', 'JOB_ROUTER_ENTRIES', 'JOB_ROUTER_ENTRIES_CMD','JOB_ROUTER_ENTRIES_FILE']:
83-
if knob in htcondor.param:
84-
used_deprecated_knobs.append(knob)
85-
if len(used_deprecated_knobs) > 0:
86-
warn(f"{', '.join(used_deprecated_knobs)} are deprecated and will be removed for V24 of the HTCondor Software Suite. New configuration"
87-
+ " syntax for the job router is defined using JOB_ROUTER_ROUTE_NAMES and JOB_ROUTER_ROUTE_<name>. For example"
88-
+ " use of new syntax visit:\nhttps://htcondor.readthedocs.io/en/latest/grid-computing/job-router.html#an-example-configuration\n\n"
89-
+ " Note: The removal will occur during the lifetime of the HTCondor V23 feature series.\n")
90-
91-
for attr in ['JOB_ROUTER_DEFAULTS', 'JOB_ROUTER_ENTRIES']:
92-
try:
93-
config_val = htcondor.param[attr]
94-
except KeyError:
95-
error("Missing %s configuration value. " % attr)
96-
continue
97-
98-
# store the ads (iterating through ClassAdStringIterator consumes them)
99-
if attr != "JOB_ROUTER_ENTRIES":
100-
try:
101-
parsed_jr_ads[attr] = list(classad.parseAds(config_val))
102-
except ValueError:
103-
# We shouldn't ever get here since classad.parseAds() only raises ValueError when it's given
104-
# non-string/non-file output and htcondor.param shouldn't contain such values
105-
debug("Failed to parse %s configuration value. " % attr)
106-
107-
# If JRD or JRE can't be parsed, the job router can't function
108-
if not parsed_jr_ads[attr]:
109-
debug("Could not read %s in the HTCondor-CE configuration. " % attr)
110-
111-
if attr == "JOB_ROUTER_ENTRIES":
112-
# Warn about routes we can find in the config that don't result in valid ads
113-
malformed_entry_names = find_malformed_entries(config_val)
114-
if malformed_entry_names:
115-
warn("Could not read JOB_ROUTER_ENTRIES in the HTCondor-CE configuration. " +
116-
"Failed to parse the following routes: %s"
117-
% ', '.join(malformed_entry_names))
118-
119-
# Warn about routes specified by JOB_ROUTER_ROUTE_NAMES that don't appear in the parsed JRE.
120-
# The job router can function this way but it's likely a config error
121-
route_order = htcondor.param.get('JOB_ROUTER_ROUTE_NAMES', '')
122-
if route_order:
123-
missing_route_def = set(route_order.replace(',',' ').split()).difference(set(parse_route_names(config_val)))
124-
if missing_route_def:
125-
warn("The following are specified in JOB_ROUTER_ROUTE_NAMES "
126-
"but cannot be found in JOB_ROUTER_ENTRIES: %s"
127-
% ', '.join(missing_route_def))
128-
129-
# Find all eval_set_ attributes in the JOB_ROUTER_DEFAULTS
130-
eval_set_defaults = set([x.lstrip('eval_') for x in parsed_jr_ads['JOB_ROUTER_DEFAULTS'][0].keys()
131-
if x.startswith('eval_set_')])
132-
133-
# Find all default_ attributes used in expressions in the JOB_ROUTER_DEFAULTS
134-
default_attr = set([re.sub(r'.*(default_\w*).*', 'eval_set_\\1', str(x))
135-
for x in parsed_jr_ads['JOB_ROUTER_DEFAULTS'][0].values()
136-
if isinstance(x, classad.ExprTree) and "default_" in str(x)])
137-
138-
for entry in parsed_jr_ads['JOB_ROUTER_ENTRIES']:
139-
# Warn users if they've set_ attributes that would be overriden by eval_set in the JOB_ROUTER_DEFAULTS
140-
overriden_attr = eval_set_defaults.intersection(set(entry.keys()))
141-
if overriden_attr:
142-
warn("%s in JOB_ROUTER_ENTRIES will be overriden by the JOB_ROUTER_DEFAULTS."
143-
% ', '.join(overriden_attr)
144-
+ " Use the 'eval_set_' prefix instead.")
145-
146-
# Ensure that users don't set the job environment in the Job Router
147-
if is_osg and any(x.endswith('environment') for x in entry.keys()):
148-
warn("Do not use the Job Router to set the environment. See documentation for more details: "
149-
+ "https://htcondor.github.io/htcondor-ce/v5/configuration/writing-job-routes/#setting-job-environments")
150-
151-
# Warn users about eval_set_ default attributes in the ENTRIES since their
152-
# evaluation may occur after the eval_set_ expressions containg them in the
153-
# JOB_ROUTER_DEFAULTS
154-
no_effect_attr = default_attr.intersection(set([x for x in entry.keys() if x.startswith('eval_set_')]))
155-
if no_effect_attr:
156-
warn("%s in JOB_ROUTER_ENTRIES " % ', '.join(no_effect_attr)
157-
+ "may not have any effect. Use the 'set_' prefix instead.")
158-
15958
# Warn users on OSG CEs if osg-configure has not been run
16059
if is_osg:
16160
try:

Diff for: tests/test_verify_ce_config.py

-72
This file was deleted.

0 commit comments

Comments
 (0)