Ejemplo n.º 1
0
def cleanUp():
    """
    _cleanUp_

    Main program

    """

    state = TaskState(os.getcwd())
    state.loadRunResDB()

    try:

        config = state._RunResDB.toDictionary()[state.taskAttrs['Name']]

    except Exception as ex:
        msg = "Unable to load details from task directory:\n"
        msg += "Error reading RunResDB XML file:\n"
        msg += "%s\n" % state.runresdb
        msg += "and extracting details for task in: %s\n" % os.getcwd()
        print msg
        exitCode = 60312
        f = open("exit.status", 'w')
        f.write(str(exitCode))
        f.close()
        sys.exit(exitCode)

    #  //
    # // find inputs by locating the task for which we are staging out
    #//  and loading its TaskState
    cleanUpParam = config.get('CleanUpParameters',{})
    cleanUpFor = cleanUpParam.get('CleanUpFor',None)
    inputState = None
    if cleanUpFor != None:
        inputTask = config['CleanUpParameters']['CleanUpFor'][0]
        inputState = getTaskState(inputTask)

    manager = CleanUpManager(state, inputState)
    exitCode = manager()


    return exitCode
Ejemplo n.º 2
0
def cleanUp():
    """
    _cleanUp_

    Main program

    """

    state = TaskState(os.getcwd())
    state.loadRunResDB()

    try:

        config = state._RunResDB.toDictionary()[state.taskAttrs['Name']]

    except Exception as ex:
        msg = "Unable to load details from task directory:\n"
        msg += "Error reading RunResDB XML file:\n"
        msg += "%s\n" % state.runresdb
        msg += "and extracting details for task in: %s\n" % os.getcwd()
        print(msg)
        exitCode = 60312
        f = open("exit.status", 'w')
        f.write(str(exitCode))
        f.close()
        sys.exit(exitCode)

    #  //
    # // find inputs by locating the task for which we are staging out
    #//  and loading its TaskState
    cleanUpParam = config.get('CleanUpParameters',{})
    cleanUpFor = cleanUpParam.get('CleanUpFor',None)
    inputState = None
    if cleanUpFor != None:
        inputTask = config['CleanUpParameters']['CleanUpFor'][0]
        inputState = getTaskState(inputTask)

    manager = CleanUpManager(state, inputState)
    exitCode = manager()


    return exitCode
Ejemplo n.º 3
0
        print msg
        exitCode = 60312
        f = open("exit.status", 'w')
        f.write(str(exitCode))
        f.close()
        sys.exit(exitCode)

    #  //
    # // find inputs by locating the task for which we are staging out
    #//  and loading its TaskState
    cleanUpParam = config.get('CleanUpParameters', {})
    cleanUpFor = cleanUpParam.get('CleanUpFor', None)
    inputState = None
    if cleanUpFor != None:
        inputTask = config['CleanUpParameters']['CleanUpFor'][0]
        inputState = getTaskState(inputTask)

    manager = CleanUpManager(state, inputState)
    exitCode = manager()

    return exitCode


if __name__ == '__main__':
    print "RuntimeCleanUp invoked..."
    exitCode = cleanUp()

    f = open("exit.status", 'w')
    f.write(str(exitCode))
    f.close()
Ejemplo n.º 4
0
        print msg
        exitCode = 60312
        f = open("exit.status", 'w')
        f.write(str(exitCode))
        f.close()
        sys.exit(exitCode)

    #  //
    # // find inputs by locating the task for which we are staging out
    #//  and loading its TaskState
    cleanUpParam = config.get('CleanUpParameters',{})
    cleanUpFor = cleanUpParam.get('CleanUpFor',None)
    inputState = None
    if cleanUpFor != None:
      inputTask = config['CleanUpParameters']['CleanUpFor'][0]
      inputState = getTaskState(inputTask)        
    
    manager = CleanUpManager(state, inputState)
    exitCode = manager()
     

    return exitCode