def test_transfer_training(self): src_subjects_path = self.root_data_folder / "src" dst_subjects_path = self.root_data_folder / "dst" transfer_rig_data.main(src_subjects_path, dst_subjects_path) gsrc = [x.name for x in list(src_subjects_path.rglob('*.*'))] gdst = [x.name for x in list(dst_subjects_path.rglob('*.*'))] self.assertTrue(set(gsrc).issubset(set(gdst))) dst_session_path = dst_subjects_path.joinpath( self.session_path.relative_to(src_subjects_path)) flag_files = [dst_session_path.joinpath('raw_session.flag')] for fl in flag_files: self.assertTrue(fl.exists()) # Test if folder exists not copy because no flag transfer_rig_data.main(src_subjects_path, dst_subjects_path) transfer_rig_data.main(src_subjects_path, dst_subjects_path) # Test if flag exists and folder exists in dst flags.write_flag_file(self.session_path.joinpath("transfer_me.flag")) (self.session_path / "raw_behavior_data" / '_iblrig_micData.raw.wav').touch() (self.session_path / "raw_video_data" / '_iblrig_leftCamera.raw.avi').touch() transfer_rig_data.main(src_subjects_path, dst_subjects_path, force=True) # Test transfer w/o video and audios flags.write_flag_file(self.session_path.joinpath("transfer_me.flag")) (self.session_path / "raw_behavior_data" / "random.data1.ext").touch() transfer_rig_data.main(src_subjects_path, dst_subjects_path, force=True)
def test_transfer(self): src_subjects_path = self.root_data_folder / "src" dst_subjects_path = self.root_data_folder / "dst" transfer_rig_data.main(src_subjects_path, dst_subjects_path) gsrc = [x.name for x in list(src_subjects_path.rglob('*.*'))] gdst = [x.name for x in list(dst_subjects_path.rglob('*.*'))] self.assertTrue('extract_me.flag' in gdst) gdst = [x for x in gdst if x != 'extract_me.flag'] self.assertTrue('compress_video.flag' in gdst) gdst = [x for x in gdst if x != 'compress_video.flag'] self.assertTrue('_iblrig_micData.raw.wav' in gdst) gdst = [x for x in gdst if x != '_iblrig_micData.raw.wav'] self.assertTrue('_iblrig_leftCamera.raw.avi' in gdst) gdst = [x for x in gdst if x != '_iblrig_leftCamera.raw.avi'] self.assertEqual(gsrc, gdst) # Test if folder exists not copy because no flag transfer_rig_data.main(src_subjects_path, dst_subjects_path) transfer_rig_data.main(src_subjects_path, dst_subjects_path) # Test if flag exists and folder exists in dst flags.write_flag_file(self.session_path.joinpath("transfer_me.flag")) (self.session_path / "raw_behavior_data" / '_iblrig_micData.raw.wav').touch() (self.session_path / "raw_video_data" / '_iblrig_leftCamera.raw.avi').touch() transfer_rig_data.main(src_subjects_path, dst_subjects_path) # Test transfer w/o video and audio flags.write_flag_file(self.session_path.joinpath("transfer_me.flag")) (self.session_path / "raw_behavior_data" / "random.data1.ext").touch() transfer_rig_data.main(src_subjects_path, dst_subjects_path)
def test_transfer_training(self): src_subjects_path = self.root_data_folder / "src" dst_subjects_path = self.root_data_folder / "dst" transfer_rig_data.main(src_subjects_path, dst_subjects_path) gsrc = [x.name for x in list(src_subjects_path.rglob('*.*'))] gdst = [x.name for x in list(dst_subjects_path.rglob('*.*'))] self.assertTrue(set(gsrc).issubset(set(gdst))) dst_session_path = dst_subjects_path.joinpath( self.session_path.relative_to(src_subjects_path)) flag_files = [dst_session_path.joinpath('raw_session.flag')] # only when all of the transfers did complete should the flag exist for fl in flag_files: self.assertFalse(fl.exists())
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Author: Niccolò Bonacchi # @Date: Thursday, July 4th 2019, 1:37:34 pm from ibllib.pipes.transfer_rig_data import main import logging import argparse log = logging.getLogger("iblrig") log.setLevel(logging.INFO) if __name__ == "__main__": parser = argparse.ArgumentParser( description="Transfer files to IBL local server") parser.add_argument("local_folder", help="Local iblrig_data/Subjects folder") parser.add_argument("remote_folder", help="Remote iblrig_data/Subjects folder") args = parser.parse_args() main(args.local_folder, args.remote_folder)