Skip to content

Commit abad8ee

Browse files
committed
Updated script. Just calls replica list for the DID, not file by file. Runs much faster.
1 parent 5a08cd8 commit abad8ee

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

files/DIDlist_Parse.sh

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,15 @@ if ! grep -q DATASET $tmp_file; then
3737
exit 3
3838
fi
3939

40-
# Checks passed, now process the file
41-
rucio did content list --short ${Scope}:${DID} > $tmp_file # Dump list of files in dataset to a file
4240
PathListFile="${Path}/${DID_Edit}_DID_Pathlist"
4341
# Need to switch this to name the DID pathlist nicely
4442
touch "${PathListFile}" # Open the file which will contain the path list
45-
NLines=$(wc --lines < $tmp_file) # Check number of files to process in total
46-
NLinesRed=$(( ((${NLines%.*}+5)/10)*10 )) # Round to nearest value of 10 to make the progress counter simpler
4743

48-
echo "Processing ${NLines} files in dataset ${Scope}:${DID}$ and creating file with list of paths - ${PathListFile}."
49-
i=0
50-
while IFS='' read -r line || [[ -n "$line" ]]; do
51-
rucio replica list file --protocols root --pfns --rses isopenaccess $line >> ${PathListFile}
52-
i=$(( $i + 1 ))
53-
if [[ $(( $i % $(( ${NLinesRed}/10 )) )) == 0 ]]; then # Go to the Microsoft school of progress tracking (aka, lying) and calculate progress
54-
Prog=$(printf %.0f "$((10**2 * ${i}/${NLinesRed}))e-0")
55-
echo "${Prog} % of file list processed"
56-
fi
57-
done < $tmp_file
44+
rucio replica list file --protocols root --pfns --rses isopenaccess ${Scope}:${DID} >> ${PathListFile}
45+
5846
echo "Parsed provided DID - $DID"
5947
echo "All files locations within this dataset have been printed to ${PathListFile}" # Need to automate this in future such that the file is named sensibly
60-
sleep 3
48+
sleep 1
6149

6250
rm $tmp_file # Delete the tmp file
6351

0 commit comments

Comments
 (0)