22
22
23
23
CE_PROBE_RPMS = ['gratia-probe-htcondor-ce' ]
24
24
25
- CONDOR_CE_CONFIG_VAL = "/usr/bin/condor_ce_config_val"
26
-
27
25
28
26
def requirements_are_installed ():
29
27
return (utilities .gateway_installed () and
@@ -69,6 +67,7 @@ def __init__(self, *args, **kwargs):
69
67
self ._old_job_managers = ['pbs' , 'sge' , 'lsf' , 'condor' , 'slurm' ]
70
68
self ._probe_config = {}
71
69
self .grid_group = 'OSG'
70
+ self .condor_enabled = False
72
71
73
72
self .log ("GratiaConfiguration.__init__ completed" )
74
73
@@ -126,6 +125,10 @@ def parse_configuration(self, configuration):
126
125
return
127
126
128
127
self ._set_enabled_probe_host (self .options ['probes' ].value )
128
+
129
+ if utilities .config_safe_getboolean (configuration , "Condor" , "enabled" ):
130
+ self .condor_enabled = True
131
+
129
132
self .log ('GratiaConfiguration.parse_configuration completed' )
130
133
131
134
def configure (self , attributes ):
@@ -241,7 +244,7 @@ def check_attributes(self, attributes):
241
244
self .log ("GratiaConfiguration.check_attributes completed" )
242
245
return True
243
246
status = self ._check_servers ()
244
- if 'htcondor-ce' in self ._probe_config :
247
+ if 'htcondor-ce' in self ._probe_config and requirements_are_installed () :
245
248
status &= self ._verify_gratia_dirs_for_htcondor_ce_probe ()
246
249
self .log ("GratiaConfiguration.check_attributes completed" )
247
250
return status
@@ -429,13 +432,19 @@ def _configure_htcondor_ce_probe(self):
429
432
def _verify_gratia_dirs_for_htcondor_ce_probe (self ) -> bool :
430
433
"""
431
434
Verify that the HTCondor-CE PER_JOB_HISTORY_DIR and the DataFolder
432
- directory are the same and warn the admin if the two don't match
433
- """
435
+ directory are the same and warn the admin if the two don't match.
434
436
435
- if not os . path . exists ( CONDOR_CE_CONFIG_VAL ):
436
- raise exceptions . ConfigureError ( f" { CONDOR_CE_CONFIG_VAL } missing" )
437
+ If the batch system is condor, look at its PER_JOB_HISTORY_DIR instead;
438
+ we want the routed jobs, but those are moved to the batch system schedd.
437
439
438
- history_dir = self ._get_condor_ce_history_dir ()
440
+ """
441
+
442
+ if self .condor_enabled :
443
+ history_dir = self ._get_condor_history_dir ()
444
+ condor_name = "Condor"
445
+ else :
446
+ history_dir = self ._get_condor_ce_history_dir ()
447
+ condor_name = "HTCondor-CE"
439
448
440
449
config_location = GRATIA_CONFIG_FILES ['htcondor-ce' ]
441
450
contents = utilities .read_file (config_location , default = "" )
@@ -445,7 +454,7 @@ def _verify_gratia_dirs_for_htcondor_ce_probe(self) -> bool:
445
454
446
455
advice_on_error = (
447
456
f"Make sure DataFolder in { config_location } ({ data_folder or 'missing' } )"
448
- f" and PER_JOB_HISTORY_DIR in the HTCondor-CE config ({ history_dir or 'missing' } )"
457
+ f" and PER_JOB_HISTORY_DIR in the { condor_name } config ({ history_dir or 'missing' } )"
449
458
f" exist and are the same, accessible directory."
450
459
)
451
460
@@ -480,24 +489,15 @@ def _verify_gratia_dirs_for_htcondor_ce_probe(self) -> bool:
480
489
self .logger .error (advice_on_error )
481
490
return False
482
491
483
- def _get_condor_ce_history_dir (self ):
484
- cmd = [CONDOR_CE_CONFIG_VAL , '-subsystem' , 'SCHEDD' , 'PER_JOB_HISTORY_DIR' ]
485
- try :
486
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , encoding = "latin-1" )
487
- history_dir , errtext = process .communicate ()
488
- if process .returncode != 0 :
489
- self .logger .info ("While checking gratia parameters: %s failed. Output follows:\n %s" ,
490
- CONDOR_CE_CONFIG_VAL , errtext )
491
- return None
492
- except OSError as err :
493
- self .logger .info ("While checking gratia parameters: Error running %s: %s" ,
494
- CONDOR_CE_CONFIG_VAL , err )
495
- return None
496
- history_dir = history_dir .strip ()
497
- if history_dir .startswith ('Not defined' ):
498
- return None
492
+ @staticmethod
493
+ def _get_condor_history_dir ():
494
+ history_dir = utilities .get_condor_config_val ("PER_JOB_HISTORY_DIR" , subsystem = "SCHEDD" , quiet_undefined = True )
499
495
return history_dir
500
496
497
+ @staticmethod
498
+ def _get_condor_ce_history_dir ():
499
+ return utilities .get_condor_ce_config_val ("PER_JOB_HISTORY_DIR" , subsystem = "SCHEDD" , quiet_undefined = True )
500
+
501
501
@staticmethod
502
502
def replace_setting (buf , setting , value , xml_file = True ):
503
503
"""
0 commit comments