Skip to content

Commit 9f818b4

Browse files
authored
Merge pull request #631 from htcondor/V24_x-HTCONDOR-2688-fix-old-python
HTCONDOR-2688 fix-old-python
2 parents 0749901 + ca87d80 commit 9f818b4

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/condor_ce_trace

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run_ping(collector_name, schedd_name):
4747
try:
4848
rc, stdout, _ = ce.run_command(args)
4949
except RuntimeError as exc:
50-
raise ce.CondorRunException('Failed to ping %s due to the following error:\n%s' % (address, exc))
50+
raise ce.CondorRunException('Failed to ping %s due to the following error:\n%s' % (schedd_name, exc))
5151

5252
if G_DEBUG:
5353
print("*"*5, "condor_ping output", "*"*5)
@@ -149,7 +149,6 @@ def check_job_submit(job_info, schedd_ad, setup_creds=True):
149149
except RuntimeError as exc:
150150
raise ce.CondorRunException(f"Failed to contact schedd at {schedd_ad['Machine']} due to the following error:\n{exc}")
151151
print(f"Submitting job to schedd {schedd_ad['MyAddress']}")
152-
ad_results = []
153152
try:
154153
result = schedd.submit(htcondor.Submit(sub), 1, True)
155154
except RuntimeError as exc:

src/htcondorce/rrd.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ def generate_graph(interval, *args):
135135

136136
def graph(environ, host, plot, interval):
137137

138-
if plot not in ['jobs', 'vos', 'metrics']:
139-
raise ValueError("Unknown plot type requested.")
140-
141138
if plot == "jobs":
142139
fname = check_rrd(environ, host, plot)
143140
graph = generate_graph(interval,
@@ -210,7 +207,8 @@ def graph(environ, host, plot, interval):
210207
"GPRINT:metric:LAST:%-6.0lf",
211208
"COMMENT:\\n",
212209
)
213-
210+
else:
211+
raise ValueError("Unknown plot type requested.")
214212

215213
return graph
216214

tests/test_condor_ce_router_defaults.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#/usr/bin/env python3
22
"""Unit tests for condor_ce_router_defaults"""
33

4-
import importlib
4+
import importlib.machinery
5+
import importlib.util
56
import os
67
import re
78
import unittest
@@ -10,7 +11,10 @@
1011
UID_FILE_PATH = 'uid_table.txt'
1112
DEFAULTS_PATH = os.path.join('..', 'src', 'condor_ce_router_defaults')
1213

13-
defaults = importlib.load_source('condor_ce_router_defaults', DEFAULTS_PATH)
14+
loader = importlib.machinery.SourceFileLoader('condor_ce_router_defaults', DEFAULTS_PATH)
15+
spec = importlib.util.spec_from_loader(loader.name, loader)
16+
defaults = importlib.util.module_from_spec(spec)
17+
loader.exec(defaults)
1418

1519
class TestDefaults(unittest.TestCase):
1620
"""Unit tests for condor_ce_router_defaults"""

0 commit comments

Comments
 (0)