def SetupLocalEnvironment(self, params=None): Utils.MakedirsIgnoreExist(self._local_dir) Utils.MakedirsIgnoreExist(self._execute_path) Utils.MakedirsIgnoreExist(self._log_path) Utils.MakedirsIgnoreExist(self._lock_path) Utils.MakedirsIgnoreExist(self._run_path) Utils.MakedirsIgnoreExist(self._spool_path) # Create a config file in this test's local directory based on existing # config settings os.system("condor_config_val -write:up " + self._local_config) # Add whatever internal config values we need config = "LOCAL_DIR = " + self._local_path + "\n" config += "EXECUTE = " + self._execute_path + "\n" config += "LOCK = " + self._lock_path + "\n" config += "RUN = " + self._run_path + "\n" config += "SPOOL = " + self._spool_path + "\n" config += "COLLECTOR_HOST = $(CONDOR_HOST):0\n" config += "MASTER_ADDRESS_FILE = $(LOG)/.master_address\n" config += "COLLECTOR_ADDRESS_FILE = $(LOG)/.collector_address\n" config += "SCHEDD_ADDRESS_FILE = $(SPOOL)/.schedd_address\n" if Utils.IsWindows() is True: config += "PROCD_ADDRESS = " + str( htcondor.param["PROCD_ADDRESS"]) + str(os.getpid()) + "\n" # Add any custom params if params is not None: for key in params: config += key + " = " + params[key] + "\n" config_file = open(self._local_config, "a") config_file.write(config) config_file.close() # Set CONDOR_CONFIG to apply the changes we just wrote to file self.SetCondorConfig() # MRC: What does this function actually do? htcondor.reload_config() # Now that we have our config setup, delete any old files potentially left over Utils.RemoveIgnoreMissing(htcondor.param["MASTER_ADDRESS_FILE"]) Utils.RemoveIgnoreMissing(htcondor.param["COLLECTOR_ADDRESS_FILE"]) Utils.RemoveIgnoreMissing(htcondor.param["SCHEDD_ADDRESS_FILE"])
def _SetupLocalEnvironment(self): Utils.MakedirsIgnoreExist(self._local_dir) Utils.MakedirsIgnoreExist(self._execute_path) Utils.MakedirsIgnoreExist(self._log_path) Utils.MakedirsIgnoreExist(self._lock_path) Utils.MakedirsIgnoreExist(self._run_path) Utils.MakedirsIgnoreExist(self._spool_path) # Create a config file in this test's local directory based on existing # config settings os.system("condor_config_val -write:up " + self._local_config) # Add whatever internal config values we need config = """ # # From PersonalCondor # """ config += "LOCAL_DIR = " + self._local_path + "\n" config += "EXECUTE = " + self._execute_path + "\n" config += "LOCK = " + self._lock_path + "\n" config += "LOG = " + self._log_path + "\n" config += "RUN = " + self._run_path + "\n" config += "SPOOL = " + self._spool_path + "\n" config += "COLLECTOR_HOST = $(CONDOR_HOST):0\n" config += "MASTER_ADDRESS_FILE = $(LOG)/.master_address\n" config += "COLLECTOR_ADDRESS_FILE = $(LOG)/.collector_address\n" config += "SCHEDD_ADDRESS_FILE = $(SPOOL)/.schedd_address\n" if Utils.IsWindows() is True: # This call to htcondor.param() will return the correct value iff # nobody set CONDOR_CONFIG without calling htcondor.reload_config(); # it's not clear if it's better for us to call that before calling # condor_config_val above, or if to avoid perturbing the system # any more than necessary. config += "PROCD_ADDRESS = " + str( htcondor.param["PROCD_ADDRESS"]) + str(os.getpid()) + "\n" config += """ # # Default params # """ for key in PersonalCondor.default_params: config += key + " = " + str( PersonalCondor.default_params[key]) + "\n" # Add any custom params if self._params is not None: config += """ # # Custom params # """ for key in self._params: if self._params[key] is None: config += key + "\n" else: config += key + " = " + str(self._params[key]) + "\n" if self._ordered_params is not None: config += """ # # Ordered params # """ config += self._ordered_params config_file = open(self._local_config, "a") config_file.write(config) config_file.close() # Set CONDOR_CONFIG to apply the changes we just wrote to file self.SetCondorConfig() # If we didn't do this, htcondor.param[] would return results from the # old CONDOR_CONFIG, which most would find astonishing (since most of # the time, there will only be a single relevant instance). htcondor.reload_config() # Now that we have our config setup, delete any old files potentially left over Utils.RemoveIgnoreMissing(htcondor.param["MASTER_ADDRESS_FILE"]) Utils.RemoveIgnoreMissing(htcondor.param["COLLECTOR_ADDRESS_FILE"]) Utils.RemoveIgnoreMissing(htcondor.param["SCHEDD_ADDRESS_FILE"])