Skip to content
Snippets Groups Projects
Commit ac8c1296 authored by Yan Grange's avatar Yan Grange :wave:
Browse files

Added last steps

parent 80e0b332
No related branches found
No related tags found
No related merge requests found
# first par is name of dataset, second one is file with list of filenames in it
rucio add-dataset lofar:$1
for fname in `cat $2`
do
rucio attach lofar:$1 fname
done
# first par is container name, second par a list of obs for the container
rucio add-container lofar:$1
for oname in `cat $2`
do
rucio attach lofar:$1 oname
done
...@@ -17,7 +17,7 @@ def data_parser(filedata, scope='lofar'): ...@@ -17,7 +17,7 @@ def data_parser(filedata, scope='lofar'):
name = os.path.basename(pth) name = os.path.basename(pth)
checkline = filedata[idx+6] checkline = filedata[idx+6]
checksum = checkline.split(":")[1].strip() checksum = checkline.split(":")[1].strip()
datafiles.append({'name':name, 'bytes': nbytes, 'adler32':checksum, 'meta':meta}) datafiles.append({'scope':scope, 'name':name, 'bytes': nbytes, 'adler32':checksum, 'meta':meta})
filepaths.append(pth) filepaths.append(pth)
return filepaths, datafiles return filepaths, datafiles
...@@ -34,16 +34,14 @@ srm_root_host = "srm://srm.grid.sara.nl" ...@@ -34,16 +34,14 @@ srm_root_host = "srm://srm.grid.sara.nl"
rucio_rse_rootdir = "srm://srm.grid.sara.nl/pnfs/grid.sara.nl/data/escape/disk/rucio/sara_dcache" rucio_rse_rootdir = "srm://srm.grid.sara.nl/pnfs/grid.sara.nl/data/escape/disk/rucio/sara_dcache"
rdt = protocol.RSEDeterministicTranslation() rdt = protocol.RSEDeterministicTranslation()
move_commands = list() move_commands = list()
topaths = list()
for frompath in filepaths: for frompath in filepaths:
fname = os.path.basename(frompath) fname = os.path.basename(frompath)
tosubpath = rdt.path(scope,fname) tosubpath = rdt.path(scope,fname)
from_address = "/".join([srm_root_host, frompath]) from_address = "/".join([srm_root_host, frompath])
to_address = "/".join([rucio_rse_rootdir, tosubpath]) to_address = "/".join([rucio_rse_rootdir, tosubpath])
topaths.append(tosubpath[len(scope)+1:]) # strip off scope and slash
move_commands.append("srmmv {src} {tgt}\n".format(src=from_address, tgt=to_address)) move_commands.append("srmmv {src} {tgt}\n".format(src=from_address, tgt=to_address))
with open("data_movescript.sh", 'w') as dms: with open("data_movescript.sh", 'w') as dms:
dms.writelines(move_commands) dms.writelines(move_commands)
with open("datapaths.pck","wb") as path_pickle: with open("datapaths.pck","wb") as path_pickle:
pickle.dump(topaths, path_pickle) pickle.dump(filelist_data, path_pickle)
...@@ -4,9 +4,14 @@ import cPickle as pickle ...@@ -4,9 +4,14 @@ import cPickle as pickle
# step 4: Add replicas for files using rucio.client.replicaclient the ReplicaClient class (add_replicas) # step 4: Add replicas for files using rucio.client.replicaclient the ReplicaClient class (add_replicas)
with open("datapaths.pck", "rb") as pathfile: with open("datapaths.pck", "rb") as pathfile:
data_paths = pickle.load(pathfile) file_details = pickle.load(pathfile)
print(data_paths[2])
rcl = replicaclient.ReplicaClient()
RSE = "SARA-DCACHE"
rcl.add_replicas(RSE, file_details):
# ideally we should catch issues here as well...
# step 4: Add dataset for each observation, add the files to the dataset
# step 5: Add container and add the cal/tgt to the container together # step 5: Add container and add the cal/tgt to the container together
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment