Ejemplo n.º 1
0
def main():
    # Registering arguments will automatically add their description to the help menu
    Script.registerArgument(
        "PFN:      Physical File Name or file containing PFNs")
    Script.registerArgument("SE:       Valid DIRAC SE")
    _, args = Script.parseCommandLine(ignoreErrors=True)

    if len(args) > 2:
        print("Only one PFN SE pair will be considered")

    from DIRAC.Interfaces.API.Dirac import Dirac

    dirac = Dirac()
    exitCode = 0

    pfn = args[0]
    seName = args[1]
    try:
        f = open(pfn, "r")
        pfns = f.read().splitlines()
        f.close()
    except Exception:
        pfns = [pfn]

    for pfn in pfns:
        result = dirac.getPhysicalFileMetadata(pfn, seName, printOutput=True)
        if not result["OK"]:
            print("ERROR: ", result["Message"])
            exitCode = 2

    DIRAC.exit(exitCode)
Ejemplo n.º 2
0
def main():
    Script.parseCommandLine(ignoreErrors=True)
    args = Script.getPositionalArgs()

    if len(args) < 2:
        Script.showHelp(exitCode=1)

    if len(args) > 2:
        print('Only one PFN SE pair will be considered')

    from DIRAC.Interfaces.API.Dirac import Dirac
    dirac = Dirac()
    exitCode = 0

    pfn = args[0]
    seName = args[1]
    try:
        f = open(pfn, 'r')
        pfns = f.read().splitlines()
        f.close()
    except BaseException:
        pfns = [pfn]

    for pfn in pfns:
        result = dirac.getPhysicalFileMetadata(pfn, seName, printOutput=True)
        if not result['OK']:
            print('ERROR: ', result['Message'])
            exitCode = 2

    DIRAC.exit(exitCode)
Ejemplo n.º 3
0
                                     '  SE:       Valid DIRAC SE' ] ) )
Script.parseCommandLine( ignoreErrors = True )
args = Script.getPositionalArgs()

if len( args ) < 2:
  Script.showHelp()

if len( args ) > 2:
  print 'Only one PFN SE pair will be considered'

from DIRAC.Interfaces.API.Dirac                       import Dirac
dirac = Dirac()
exitCode = 0

pfn = args[0]
seName = args[1]
try:
  f = open( pfn, 'r' )
  pfns = f.read().splitlines()
  f.close()
except:
  pfns = [pfn]

for pfn in pfns:
  result = dirac.getPhysicalFileMetadata( pfn, seName, printOutput = True )
  if not result['OK']:
    print 'ERROR: ', result['Message']
    exitCode = 2

DIRAC.exit( exitCode )
Ejemplo n.º 4
0
                                  '  SE:       Valid DIRAC SE']))
Script.parseCommandLine(ignoreErrors=True)
args = Script.getPositionalArgs()

if len(args) < 2:
  Script.showHelp()

if len(args) > 2:
  print('Only one PFN SE pair will be considered')

from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
exitCode = 0

pfn = args[0]
seName = args[1]
try:
  f = open(pfn, 'r')
  pfns = f.read().splitlines()
  f.close()
except BaseException:
  pfns = [pfn]

for pfn in pfns:
  result = dirac.getPhysicalFileMetadata(pfn, seName, printOutput=True)
  if not result['OK']:
    print('ERROR: ', result['Message'])
    exitCode = 2

DIRAC.exit(exitCode)