Ejemplo n.º 1
0
def main(startup_dir, force=True):
    # get the pids
    try:
        factory_pid = glideFactoryPidLib.get_factory_pid(startup_dir)
    except RuntimeError, e:
        print e
        return 1
Ejemplo n.º 2
0
def main(startup_dir,force=True):
    # get the pids
    try:
        factory_pid=glideFactoryPidLib.get_factory_pid(startup_dir)
    except RuntimeError, e:
        print e
        if str(e) == "Factory not running":
            # Workaround to distinguish when the factory is not running
            # string must be the same as in glideFactoryPidLib
            return 2
        return 1
Ejemplo n.º 3
0
def main(startup_dir,force=True):
    # get the pids
    try:
        factory_pid=glideFactoryPidLib.get_factory_pid(startup_dir)
    except RuntimeError as e:
        print(e)
        if str(e) == "Factory not running":
            # Workaround to distinguish when the factory is not running
            # string must be the same as in glideFactoryPidLib
            return 2
        return 1
    #print factory_pid

    factory_pgid = os.getpgid(factory_pid)

    if not glideFactoryPidLib.pidSupport.check_pid(factory_pid):
        # Factory already dead
        return 0

    # kill processes
    # first soft kill the factoryprocess group  (50s timeout)
    if (kill_and_check_pgid(factory_pgid) == 0):
        return 0

    if not force:
        print("Factory did not die within the timeout")
        return 1

    # retry soft kill the factory... should exit now (5s timeout)
    if (kill_and_check_pgid(factory_pgid, retries=30, signr=signal.SIGTERM) == 0):
        return 0

    print("Factory or children still alive... sending hard kill")

    try:
        os.killpg(factory_pgid, signal.SIGKILL)
    except OSError:
        # in case they died between the last check and now
        pass

    return 0
Ejemplo n.º 4
0
#
# Project:
#   glideinWMS
#
# File Version: 
#
# Description:
#   Check if a glideinFactory is running
# 
# Arguments:
#   $1 = glidein submit_dir (i.e. factory dir)
#
# Author:
#   Igor Sfiligoi Jul 9th 2008
#

import sys,os.path
sys.path.append(os.path.join(sys.path[0],"../.."))
from glideinwms.factory import glideFactoryPidLib

try:
    startup_dir=sys.argv[1]
    factory_pid=glideFactoryPidLib.get_factory_pid(startup_dir)
except:
    print "Not running"
    sys.exit(1)

print "Running"
sys.exit(0)

Ejemplo n.º 5
0
#!/usr/bin/env python
#
# Project:
#   glideinWMS
#
# File Version:
#
# Description:
#   Check if a glideinFactory is running
#
# Arguments:
#   $1 = glidein submit_dir (i.e. factory dir)
#
# Author:
#   Igor Sfiligoi Jul 9th 2008
#

from __future__ import print_function
import sys
from glideinwms.factory import glideFactoryPidLib

try:
    startup_dir = sys.argv[1]
    factory_pid = glideFactoryPidLib.get_factory_pid(startup_dir)
except:
    print("Not running")
    sys.exit(1)

print("Running")
sys.exit(0)