"""
Synchronisation of processed GHOST data from gpfs to esarchive

"""

import os
import sys
import subprocess
import time

sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/../download_scripts')
from download_parameters import all_nrt_networks


script_root = str(sys.argv[1])
data_root = str(sys.argv[2])

# networks: default or submitted one
if str(sys.argv[2]) == 'default':
    networks = all_nrt_networks
else:
    networks = [str(sys.argv[3])]

print('networks ', networks)

for network in networks:

    # do the sync per network
    subprocess.run([script_root+'/rsync_from_gpfs_to_esarchive.sh', data_root, network])
