Example #1
0
def which(cmd):
    command = ['which', cmd]
    runner = cmsIO.cmsFileManip()
    out, _, _ = runner.runCommand(command)

    lines = [line for line in out.split('\n') if line]
    if len(lines) == 1:
        return lines[0]
    elif len(lines) == 2:
        return lines[1]
    else:
        return lines
Example #2
0
def which(cmd):
    command = ['which', cmd]
    runner = cmsIO.cmsFileManip()
    out, _, _ = runner.runCommand(command)
    
    lines = [line for line in out.split('\n') if line]
    if len(lines) == 1:
        return lines[0]
    elif len(lines) == 2:
        return lines[1]
    else:
        return lines
Example #3
0
def runXRDCommand(path, cmd, *args):
    """Run an xrd command.
    """
    
    lfn = eosToLFN(path)
    #print "lfn:", lfn, cmd
    tokens = cmsIO.splitPFN(lfnToPFN(lfn))
    
    command = ['xrd', tokens[1], cmd, tokens[2]]
    command.extend(args)
    runner = cmsIO.cmsFileManip()
    # print ' '.join(command)
    return runner.runCommand(command)
Example #4
0
def runXRDCommand(path, cmd, *args):
    """Run an xrd command.
    """

    lfn = eosToLFN(path)
    #print "lfn:", lfn, cmd
    tokens = cmsIO.splitPFN(lfnToPFN(lfn))

    command = ['xrd', tokens[1], cmd, tokens[2]]
    command.extend(args)
    runner = cmsIO.cmsFileManip()
    # print ' '.join(command)
    return runner.runCommand(command)
Example #5
0
def runXRDCommand(path, cmd, *args):
    """Run an xrd command.

    !!! Will, what is happening in case of problem?
    ??? At some point, should return a list of lines instead of a string."""

    lfn = eosToLFN(path)
    tokens = cmsIO.splitPFN(lfnToPFN(lfn))

    command = ['xrd', tokens[1], cmd, tokens[2]]
    command.extend(args)
    runner = cmsIO.cmsFileManip()
    # print ' '.join(command)
    return runner.runCommand(command)
Example #6
0
def runXRDCommand(path, cmd, *args):
    """Run an xrd command.

    !!! Will, what is happening in case of problem?
    ??? At some point, should return a list of lines instead of a string."""
    
    lfn = eosToLFN(path)
    tokens = cmsIO.splitPFN(lfnToPFN(lfn))
    
    command = ['xrd', tokens[1], cmd, tokens[2]]
    command.extend(args)
    runner = cmsIO.cmsFileManip()
    # print ' '.join(command)
    return runner.runCommand(command)
Example #7
0
def _xrdcpSingleFile(pfn_src, pfn_dest):
    """Copies a single file using xrd."""

    command = ['xrdcp', '-force']
    command.append(pfn_src)
    command.append(pfn_dest)
    # print ' '.join(command)
    run = True
    if run:
        runner = cmsIO.cmsFileManip()
        out, err, ret = runner.runCommand(command)
        if err:
            print >> sys.stderr, out
            print >> sys.stderr, err
        return ret
Example #8
0
def _xrdcpSingleFile( pfn_src, pfn_dest):
    """Copies a single file using xrd."""
    
    command = ['xrdcp']
    command.append(pfn_src)
    command.append(pfn_dest)
    # print ' '.join(command)
    run = True
    if run: 
        runner = cmsIO.cmsFileManip()
        out, err, ret = runner.runCommand(command)
        if err:
            print >> sys.stderr, out
            print >> sys.stderr, err
        return ret
Example #9
0
def cmsStage(absDestDir, files, force):
    """Runs cmsStage with LFNs if possible"""

    destIsEOSDir = isEOSDir(absDestDir)
    if destIsEOSDir:
        createEOSDir(absDestDir)

    for fname in files:
        command = ['cmsStage']
        if force:
            command.append('-f')
        command.append(eosToLFN(fname))
        command.append(eosToLFN(absDestDir))
        print ' '.join(command)
        runner = cmsIO.cmsFileManip()
        runner.runCommand(command)
Example #10
0
def cmsStage( absDestDir, files, force):
    """Runs cmsStage with LFNs if possible"""

    destIsEOSDir = isEOSDir(absDestDir)
    if destIsEOSDir: 
        createEOSDir( absDestDir )

    for fname in files:
        command = ['cmsStage']
        if force:
            command.append('-f')
        command.append(eosToLFN(fname))
        command.append(eosToLFN(absDestDir))
        print ' '.join(command)
        runner = cmsIO.cmsFileManip()
        runner.runCommand(command)
Example #11
0
def runEOSCommand(path, cmd, *args):
    """Run an eos command.
    !!! Will, when the EOS command fails, it passes silently...
    I think we should really try and raise an exception in case of problems.
    should be possible as the return code is provided in the tuple returned by runner."""
    
    lfn = eosToLFN(path)
    pfn = lfnToPFN(lfn)
    tokens = cmsIO.splitPFN(pfn)
    
    #obviously, this is not nice
    command = ['/afs/cern.ch/project/eos/installation/pro/bin/eos.select', cmd]
    command.extend(args)
    command.append(tokens[2])
    runner = cmsIO.cmsFileManip()
    return runner.runCommand(command)
Example #12
0
def runEOSCommand(path, cmd, *args):
    """Run an eos command.
    !!! Will, when the EOS command fails, it passes silently...
    I think we should really try and raise an exception in case of problems.
    should be possible as the return code is provided in the tuple returned by runner."""

    lfn = eosToLFN(path)
    pfn = lfnToPFN(lfn)
    tokens = cmsIO.splitPFN(pfn)

    #obviously, this is not nice
    command = ['/afs/cern.ch/project/eos/installation/pro/bin/eos.select', cmd]
    command.extend(args)
    command.append(tokens[2])
    runner = cmsIO.cmsFileManip()
    return runner.runCommand(command)
Example #13
0
def runDBS(dataset):
    cmd = 'file dataset='+dataset
    command = ['das_client.py', '--limit=0', '--query', cmd]
    runner = cmsIO.cmsFileManip()
    # print ' '.join(command)
    return runner.runCommand(command)
Example #14
0
def runDBS(dataset):
    cmd = 'file dataset=' + dataset
    command = ['das_client.py', '--limit=0', '--query', cmd]
    runner = cmsIO.cmsFileManip()
    # print ' '.join(command)
    return runner.runCommand(command)