Skip to content

Commit

Permalink
Prefer condor_remote_cluster to bosco_cluster if both are availab…
Browse files Browse the repository at this point in the history
…le (SOFTWARE-4973)
  • Loading branch information
matyasselmeci committed Feb 24, 2022
1 parent 2fec77c commit 5f0f6f5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions osg_configure/configure_modules/bosco.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, *args, **kwargs):


self.config_section = "BOSCO"
self.bosco_cluster = None
self.log("BoscoConfiguration.__init__ completed")


Expand Down Expand Up @@ -181,7 +182,13 @@ def configure(self, attributes):
return True

# Do all the things here!

self.bosco_cluster = shutil.which("condor_remote_cluster") or shutil.which("bosco_cluster")

if not self.bosco_cluster and self.opt_val("install_cluster") != "never":
self.log("Cannot install remote cluster: neither condor_remote_cluster nor bosco_cluster were found",
level=logging.ERROR)
return False

# For each user, install bosco.
for username in self.options['users'].value.split(","):
username = username.strip()
Expand Down Expand Up @@ -273,7 +280,7 @@ def result():

if self.opt_val("install_cluster") == "if_needed":
# Only install if it's not in the clusterlist
cmd = ["bosco_cluster", "-l"]
cmd = [self.bosco_cluster, "-l"]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
preexec_fn=demote(user_uid, user_gid), env=env,
encoding="latin-1")
Expand All @@ -290,13 +297,13 @@ def result():
self.log("Entry found in clusterlist", level=logging.DEBUG)
return True
else:
self.log("bosco_cluster -l failed with unexpected exit code %d" % returncode, level=logging.ERROR)
self.log("%s failed with unexpected exit code %d", " ".join(cmd), returncode, level=logging.ERROR)
self.log("stdout:\n%s" % stdout, level=logging.ERROR)
self.log("stderr:\n%s" % stderr, level=logging.ERROR)
return False

# Run bosco cluster to install the remote cluster
install_cmd = ["bosco_cluster"]
install_cmd = [self.bosco_cluster]
override_dir = self.opt_val('override_dir')
if override_dir:
install_cmd += ['-o', override_dir]
Expand Down

0 comments on commit 5f0f6f5

Please sign in to comment.