def pbsCommand(command, cp): """ Run a command against the PBS batch system. Use this when talking to PBS; not only does it allow for integration into the GIP test framework, but it also filters and expands PBS-style line continuations. """ try: pbsHost = cp.get("pbs", "host") except: pbsHost = "" if pbsHost.lower() == "none" or pbsHost.lower() == "localhost": pbsHost = "" pbs_path = cp_get(cp, "pbs", "pbs_path", ".") addToPath(pbs_path) addToPath(pbs_path + "/bin") cmd = command % {'pbsHost': pbsHost} fp = runCommand(cmd) #pid, exitcode = os.wait() #if exitcode != 0: # raise Exception("Command failed: %s" % cmd) return pbsOutputFilter(fp)
def main(): """ Main wrapper for the Condor batch system GIP information. """ try: cp = config() condor_path = cp_get(cp, "condor", "condor_path", None) condor_location = cp_get(cp, "condor", "condor_location", None) condor_config = cp_get(cp, "condor", "condor_config", None) if condor_path != None: addToPath(condor_path) if condor_location != None: addToPath('%s/bin' % condor_location) if not condor_config: condor_config = '%s/etc/condor_config' % condor_location if condor_config: os.environ['CONDOR_CONFIG'] = condor_config #vo_map = VoMapper(cp) getLrmsInfo(cp) print_CE(cp) print_VOViewLocal(cp) except Exception, e: log.exception(e) raise
def slurmCommand(command, cp): """ Run a command against the SLURM batch system. """ slurm_path = cp_get(cp, "slurm", "slurm_path", ".") addToPath(slurm_path) addToPath(slurm_path + "/bin") fp = runCommand(command) return slurmOutputFilter(fp)
def main(): try: cp = config() bootstrapSGE(cp) addToPath(cp_get(cp, "sge", "sge_path", ".")) vo_map = VoMapper(cp) pbsVersion = getLrmsInfo(cp) print_CE(cp) print_VOViewLocal(cp) except Exception, e: sys.stdout = sys.stderr log.error(e) raise
def main(): try: cp = config() slurm_path = cp_get(cp, "slurm", "slurm_path", ".") addToPath(slurm_path) # adding slurm_path/bin to the path as well, since slurm/torque home # points to /usr/local and the binaries exist in /usr/local/bin addToPath(slurm_path + "/bin") vo_map = VoMapper(cp) slurmVersion = getLrmsInfo(cp) queueInfo = print_CE(cp) print_VOViewLocal(queueInfo, cp) except Exception, e: sys.stdout = sys.stderr log.exception(e) raise
def getCEList(cp, extraCEs=[]): """ Return a list of all the CE names at this site. If WS-GRAM is installed, this might additionally return some WS-GRAM entries (this feature is not yet implemented). @param cp: Site configuration @returns: List of strings containing all the local CE names. """ jobman = cp.get(ce, "job_manager").strip().lower() hostnames = [cp.get(ce, 'name')] hostnames += extraCEs prefix = 'jobmanager' port = 2119 if cp_getBoolean(cp, 'cream', 'enabled', False): prefix = 'cream' port = 8443 ce_names = [ '%s:%d/%s-%s-%%s' % (hostname, port, prefix, jobman) for hostname in hostnames ] ce_list = [] if jobman == 'pbs': queue_entries = getPBSQueueList(cp) elif jobman == 'lsf': from gip.providers.lsf import bootstrapLSF bootstrapLSF(cp) queue_entries = getLSFQueueList(cp) elif jobman == 'condor': queue_entries = getCondorQueueList(cp) elif jobman == 'slurm': queue_entries = getSlurmQueueList(cp) elif jobman == 'sge': from gip.providers.sge import bootstrapSGE from gip_common import addToPath bootstrapSGE(cp) addToPath(cp_get(cp, "sge", "sge_path", ".")) queue_entries = getSGEQueueList(cp) else: raise ValueError("Unknown job manager %s." % jobman) for queue in queue_entries: for ce_name in ce_names: ce_list.append(ce_name % queue) return ce_list
def getCEList(cp, extraCEs=[]): """ Return a list of all the CE names at this site. If WS-GRAM is installed, this might additionally return some WS-GRAM entries (this feature is not yet implemented). @param cp: Site configuration @returns: List of strings containing all the local CE names. """ jobman = cp.get(ce, "job_manager").strip().lower() hostnames = [cp.get(ce, 'name')] hostnames += extraCEs prefix = 'jobmanager' port = 2119 if cp_getBoolean(cp, 'cream', 'enabled', False): prefix = 'cream' port = 8443 if cp_getBoolean(cp, 'htcondorce', 'enabled', False): prefix = 'htcondorce' port = getHTCondorCEPort() ce_names = ['%s:%d/%s-%s-%%s' % (hostname, port, prefix, jobman) for hostname in hostnames] ce_list = [] if jobman == 'pbs': queue_entries = getPBSQueueList(cp) elif jobman == 'lsf': from gip.providers.lsf import bootstrapLSF bootstrapLSF(cp) queue_entries = getLSFQueueList(cp) elif jobman == 'condor': queue_entries = getCondorQueueList(cp) elif jobman == 'slurm': queue_entries = getSlurmQueueList(cp) elif jobman == 'sge': from gip.providers.sge import bootstrapSGE from gip_common import addToPath bootstrapSGE(cp) addToPath(cp_get(cp, "sge", "sge_path", ".")) queue_entries = getSGEQueueList(cp) else: raise ValueError("Unknown job manager %s." % jobman) for queue in queue_entries: for ce_name in ce_names: ce_list.append(ce_name % queue) return ce_list
def main(): """ Wrapper for printing out the LSF-related GLUE objects. """ log.debug("Beginning LSF provider") try: cp = config() lsf_path = cp_get(cp, "lsf", "lsf_location", None) if lsf_path: addToPath(lsf_path) bootstrapLSF(cp) #vo_map = VoMapper(cp) queueInfo, _, _, _ = print_CE(cp) print_VOViewLocal(queueInfo, cp) except Exception, e: sys.stdout = sys.stderr log.exception(e) raise
def doPath(cp): # add condor binaries to system path condor_path = cp_get(cp, "condor", "condor_path", None) condor_location = cp_get(cp, "condor", "condor_location", None) condor_config = cp_get(cp, "condor", "condor_config", None) if isDefined(condor_path): addToPath(condor_path) if isDefined(condor_location): log.info("Adding %s/bin to path" % condor_location) addToPath('%s/bin' % condor_location) if not isDefined(condor_config): condor_config = '%s/etc/condor_config' % condor_location if isDefined(condor_config): os.environ['CONDOR_CONFIG'] = condor_config