Skip to content

Commit 5f95038

Browse files
committed
make getRucio its own function
1 parent 9acb20c commit 5f95038

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

get_files_on_disk.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,22 @@ def getOS():
1717
osv = subprocess.check_output(shlex.split(cmd), encoding="utf-8").rstrip()
1818
return osv
1919

20-
def getHosted(dataset, user, allow=None, block=None):
21-
"""Gets list of files on disk for a dataset, and list of sites along with how many files each site has"""
22-
if allow is not None and block is not None:
23-
raise RuntimeError("Cannot specify both allow list and block list, pick one")
24-
20+
def getRucio(user):
21+
"""Adds Rucio libraries to python path with requisite environment variables"""
2522
osv = getOS()
2623
rucio_path = f'/cvmfs/cms.cern.ch/rucio/x86_64/rhel{osv}/py3/current'
2724
os.environ['RUCIO_HOME'] = rucio_path
2825
os.environ['RUCIO_ACCOUNT'] = user
2926
full_rucio_path = glob.glob(rucio_path+'/lib/python*.*')[0]
3027
sys.path.insert(0,full_rucio_path+'/site-packages/')
3128

29+
def getHosted(dataset, user, allow=None, block=None):
30+
"""Gets list of files on disk for a dataset, and list of sites along with how many files each site has"""
31+
if allow is not None and block is not None:
32+
raise RuntimeError("Cannot specify both allow list and block list, pick one")
33+
34+
getRucio(user)
35+
3236
warnings.filterwarnings("ignore", message=".*cryptography.*")
3337
from rucio.client.client import Client # pylint: disable=import-error,import-outside-toplevel
3438
client = Client()

0 commit comments

Comments
 (0)