File size: 1,240 Bytes
7daf628 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | """Path utils."""
from os.path import dirname, abspath
curr_filepath = abspath(__file__)
repo_path = dirname(dirname(dirname(curr_filepath)))
def get_data_root_from_hostname(use_tmp=False):
import socket
import os
# Check use_tmp as an environment variable
if "USE_TMP" in os.environ:
use_tmp = True
# TODO: if use_tmp, then use the local /tmp folder on the node
data_root_lib = {
"diva": "/ssd/pbagad/datasets/",
"node": "/var/scratch/pbagad/datasets/",
"fs4": "/var/scratch/pbagad/datasets/",
"vggdev21": "/scratch/shared/beegfs/piyush/datasets/",
"node407": "/var/scratch/pbagad/datasets/",
"gnodee5": "/scratch/shared/beegfs/piyush/datasets/",
"gnodeg2": "/scratch/shared/beegfs/piyush/datasets/",
"gnodec2": "/scratch/shared/beegfs/piyush/datasets/",
"Piyushs-MacBook-Pro": "/Users/piyush/projects/",
"dev21": "/scratch/shared/beegfs/piyush/datasets/",
}
hostname = socket.gethostname()
hostname = hostname.split(".")[0]
assert hostname in data_root_lib.keys(), \
"Hostname {} not in data_root_lib".format(hostname)
data_root = data_root_lib[hostname]
return data_root
|