def dumpFileStates(workDir, jobId, type="output"):
    """ Update the current file states (for all files) """

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, type=type)

    # dump file states for all files
    FS.dumpFileStates(type=type)

    # cleanup
    del FS
Example #2
0
def dumpFileStates(workDir, jobId, ftype="output"):
    """ Update the current file states (for all files) """

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype=ftype)

    # dump file states for all files
    FS.dumpFileStates(ftype=ftype)

    # cleanup
    del FS
Example #3
0
def updateFileState(fileName, workDir, jobId, mode="file_state", state="not_created", ftype="output"):
    """ Update the current file states (for all files) """

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype=ftype)

    # update this file
    FS.updateState(fileName, mode=mode, state=state)

    # cleanup
    del FS
def getFileState(fileName, workDir, jobId, type="output"):
    """ Return the current state of a given file """

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, type=type)

    # update this file
    state = FS.getFileState(fileName)

    # cleanup
    del FS

    return state
Example #5
0
def getFileState(fileName, workDir, jobId, ftype="output"):
    """ Return the current state of a given file """

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype=ftype)

    # update this file
    state = FS.getFileState(fileName)

    # cleanup
    del FS

    return state
Example #6
0
def getFilesOfState(workDir, jobId, ftype="output", state="transferred"):
    """ Return a comma-separated list of files in a given state"""

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype=ftype)

    # get the list
    filenames = FS.getFilesOfState(state=state)

    # cleanup
    del FS

    return filenames
Example #7
0
def getFilesOfState(workDir, jobId, ftype="output", state="transferred"):
    """ Return a comma-separated list of files in a given state"""

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype=ftype)

    # get the list
    filenames = FS.getFilesOfState(state=state)

    # cleanup
    del FS

    return filenames
def hasOnlyCopyToScratch(workDir, jobId):
    """ Check if there are only copy_to_scratch tranfer modes in the file dictionary """
    # goal: remove --directIn in cmd3 if there are only transfer mode "copy_to_scratch" files

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, type="input")

    # are there only "copy_to_scratch" files in the file dictionary?
    status = FS.hasOnlyCopyToScratch()

    # cleanup
    del FS

    return status
Example #9
0
def hasOnlyCopyToScratch(workDir, jobId):
    """ Check if there are only copy_to_scratch tranfer modes in the file dictionary """
    # goal: remove --directIn in cmd3 if there are only transfer mode "copy_to_scratch" files

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype="input")

    # are there only "copy_to_scratch" files in the file dictionary?
    status = FS.hasOnlyCopyToScratch()

    # cleanup
    del FS

    return status
def updateFileState(fileName,
                    workDir,
                    jobId,
                    mode="file_state",
                    state="not_created",
                    type="output"):
    """ Update the current file states (for all files) """

    # create a temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, type=type)

    # update this file
    FS.updateState(fileName, mode=mode, state=state)

    # cleanup
    del FS
Example #11
0
def createFileStates(workDir, jobId, outFiles=None, inFiles=None, logFile=None, ftype="output"):
    """ Create the initial file state dictionary """

    # file list
    if ftype == "output":
        files = outFiles
        files.append(logFile)
    else:
        files = inFiles

    # create temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, ftype=ftype)
    FS.resetStates(files, ftype=ftype)

    # cleanup
    del FS
def createFileStates(workDir,
                     jobId,
                     outFiles=None,
                     inFiles=None,
                     logFile=None,
                     type="output"):
    """ Create the initial file state dictionary """

    # file list
    if type == "output":
        files = outFiles
        files.append(logFile)
    else:
        files = inFiles

    # create temporary file state object
    FS = FileState(workDir=workDir, jobId=jobId, type=type)
    FS.resetStates(files, type=type)

    # cleanup
    del FS