From f384b5b2be47925e0715a8a78b19b8ca3bf679a1 Mon Sep 17 00:00:00 2001 From: Yan Grange <grange@astron.nl> Date: Mon, 24 Aug 2020 16:56:23 +0200 Subject: [PATCH] SDC-45: Movescript is ready --- .gitignore | 2 ++ move_to_rucio.py => create_movescript.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) rename move_to_rucio.py => create_movescript.py (79%) diff --git a/.gitignore b/.gitignore index ef94873..4d6a712 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 5de3121..06f5d51 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) -- GitLab