def test_sync_from_dir_noop_local(self):
        path = os.path.join(self.tmp_dir.name, 'lorem', 'ipsum.txt')
        src = os.path.join(self.tmp_dir.name, 'lorem')
        make_dir(src, check_empty=False)

        fs = FileSystem.get_file_system(src, 'r')
        fs.write_bytes(path, bytes([0x00, 0x01]))
        sync_from_dir(src, src, delete=True)

        self.assertEqual(len(list_paths(src)), 1)
示例#2
0
def fetch_cmd_dir(root_uri: str, cmd: str, download_dir: str) -> str:
    """Download the output directory of a particular RV command, located at
    root_uri/cmd (e.g. root_uri/eval) to the download_dir directory.
    """
    cmd_root_uri = join(root_uri, cmd)
    console_info(f'Fetching {cmd} directory: {cmd_root_uri}')
    cmd_root_uri_local = to_local_uri(cmd_root_uri,
                                      download_dir,
                                      full_path=False)
    sync_from_dir(cmd_root_uri, cmd_root_uri_local)
    return cmd_root_uri_local
 def test_sync_from_http(self):
     src = 'http://localhost/'
     dst = self.tmp_dir.name
     self.assertRaises(NotReadableError, lambda: sync_from_dir(src, dst))
示例#4
0
 def sync_from_cloud(self):
     """Sync any previous output in the cloud to output_dir."""
     sync_from_dir(self.cfg.output_uri, self.output_dir)
示例#5
0
 def sync_from_cloud(self):
     """Sync any previous output in the cloud to output_dir."""
     if self.cfg.output_uri.startswith('s3://'):
         sync_from_dir(self.cfg.output_uri, self.output_dir)