def exe_condor_advertise(fname, command, is_multi=False, factory_collector=None):
    global factoryConfig

    if factory_collector == DEFAULT_VAL:
        factory_collector = factoryConfig.factory_collector

    lock_fname = os.path.join(factoryConfig.lock_dir, "gfi_advertize.lock")
    if not os.path.exists(lock_fname):  # create a lock file if needed
        try:
            fd = open(lock_fname, "w")
            fd.close()
        except:
            # could be a race condition
            pass

    fd = open(lock_fname, "r+")
    try:
        fcntl.flock(fd, fcntl.LOCK_EX)
        try:
            ret = condorManager.condorAdvertise(
                fname, command, factoryConfig.advertise_use_tcp, is_multi, factory_collector
            )
        finally:
            fcntl.flock(fd, fcntl.LOCK_UN)
    finally:
        fd.close()

    return ret
Exemple #2
0
def exe_condor_advertise(fname, command,
                         is_multi=False, factory_collector=None):
    global factoryConfig

    if factory_collector == DEFAULT_VAL:
        factory_collector = factoryConfig.factory_collector

    lock_fname = os.path.join(factoryConfig.lock_dir, "gfi_advertize.lock")
    if not os.path.exists(lock_fname):  # create a lock file if needed
        try:
            fd = open(lock_fname, "w")
            fd.close()
        except:
            # could be a race condition
            pass

    fd = open(lock_fname, "r+")
    try:
        fcntl.flock(fd, fcntl.LOCK_EX)
        try:
            ret = condorManager.condorAdvertise(fname, command, factoryConfig.advertise_use_tcp,
                                                is_multi, factory_collector)
        finally:
            fcntl.flock(fd, fcntl.LOCK_UN)
    finally:
        fd.close()

    return ret
def exe_condor_advertise(fname, command, pool, is_multi=False):
    logSupport.log.debug("CONDOR ADVERTISE %s %s %s %s" % (fname, command, pool, is_multi))
    return condorManager.condorAdvertise(fname, command, frontendConfig.advertise_use_tcp, is_multi, pool)