Commit ca20e10c authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Merge branch 'testing'

parents 39731527 01d95ec2
Loading
Loading
Loading
Loading

tests/test_xrootd_3.py

0 → 100644
+33 −0
Original line number Diff line number Diff line
from XRootD import client
from XRootD.client.flags import DirListFlags
from XRootD.client.flags import StatInfoFlags
from XRootD.client.flags import OpenFlags
from pathlib import Path


myclient = client.FileSystem('root://tape_frontend')
myserver = client.FileSystem('root://transfer_node')
status, listing = myclient.dirlist('/home/tape_frontend/data/aaa/', DirListFlags.STAT)

for entry in listing:
    if entry.statinfo.flags == 16:
        src = "root://tape_frontend//home/tape_frontend/data/aaa/" + entry.name
        dest = "root://transfer_node//home/transfer_node/data/aaa/" + entry.name
        print(src, dest)

status, listing = myclient.dirlist('/home/tape_frontend/data/aaa/', DirListFlags.RECURSIVE, 0)

for entry in listing:
    if entry.statinfo.flags == 16:
        src = "root://tape_frontend//home/tape_frontend/data/aaa/" + entry.name
        dest = "root://transfer_node//home/transfer_node/data/aaa/" + entry.name
        process = client.CopyProcess()
        process.add_job(source = src, target = dest, mkdir = True, force = True)
        p = process.prepare()
        r = process.run()
        print(r, p)
    else:
        # it's a dir...
        myserver.mkdir(entry.name)

print("Transfer completed.") 
+8 −3
Original line number Diff line number Diff line
@@ -24,7 +24,12 @@ time.sleep(10)
print("Starting XRootD transfer test [remote-to-remote]...")
process = client.CopyProcess()
process.add_job(source = 'root://tape_frontend//home/tape_frontend/data/aaa/1.txt',
                target = 'root://transfer_node//home/transfer_node/data/1.txt', 
                target = 'root://transfer_node//home/transfer_node/data/aaa/1.txt',
                mkdir = True,
                force = True )
process.add_job(source = 'root://tape_frontend//home/tape_frontend/data/aaa/3.txt',
                target = 'root://transfer_node//home/transfer_node/data/aaa/3.txt',
                mkdir = True,
                force = True )
process.prepare()
process.run()