diff --git a/.gitignore b/.gitignore index ef948737c9d9bc581a80f4016b63c1a50763a38b..4d6a7122f87ac0abe9280c6340737608ae7b01d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ rucio-client.simg source_data_list.dat +data_movescript.sh +datapaths.pck diff --git a/move_to_rucio.py b/create_movescript.py similarity index 79% rename from move_to_rucio.py rename to create_movescript.py index 5de312164d0241da0aa64526a046b22b3db2f79a..06f5d5132b5674a7331e18ce1c5f0a55f47ac01a 100755 --- a/move_to_rucio.py +++ b/create_movescript.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os from rucio.rse.protocols import protocol +import cPickle as pickle def data_parser(filedata, scope='lofar'): datafiles = list() @@ -32,15 +33,17 @@ scope = 'lofar' 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" rdt = protocol.RSEDeterministicTranslation() +move_commands = list() +topaths = list() for frompath in filepaths: fname = os.path.basename(frompath) tosubpath = rdt.path(scope,fname) from_address = "/".join([srm_root_host, frompath]) to_address = "/".join([rucio_rse_rootdir, tosubpath]) - print("srmmv {src} {tgt}".format(src=from_address, tgt=to_address)) + topaths.append(to_address) + move_commands.append("srmmv {src} {tgt}".format(src=from_address, tgt=to_address)) +with open("data_movescript.sh", 'w') as dms: + dms.writelines(move_commands) -# step 4: Add replicas for files using rucio.client.replicaclient the ReplicaClient class (add_replicas) - -# 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 +with open("datapaths.pck","wb") as path_pickle: + pickle.dump(topaths, path_pickle)