Esempio n. 1
0
def cleanUp():
    """
    _cleanUp_

    Main program

    """
       
    state = TaskState(os.getcwd())
    state.loadRunResDB()
        
    try:
        
        config = state._RunResDB.toDictionary()[state.taskAttrs['Name']]
         
    except StandardError, 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)
Esempio n. 2
0
def cleanUp():
    """
    _cleanUp_

    Main program

    """

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

    try:

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

    except StandardError, 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)
Esempio n. 3
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
Esempio n. 4
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