Pull data items in a cloud-agnostic way. Args: objs: objects to pull from the cloud. jobs: number of jobs that can be running simultaneously. remote: optional name of remote to pull from. By default remote from core.remote config option is
(
self,
objs: Iterable["HashInfo"],
jobs: Optional[int] = None,
remote: Optional[str] = None,
odb: Optional["HashFileDB"] = None,
)
| 226 | ) |
| 227 | |
| 228 | def pull( |
| 229 | self, |
| 230 | objs: Iterable["HashInfo"], |
| 231 | jobs: Optional[int] = None, |
| 232 | remote: Optional[str] = None, |
| 233 | odb: Optional["HashFileDB"] = None, |
| 234 | ) -> "TransferResult": |
| 235 | """Pull data items in a cloud-agnostic way. |
| 236 | |
| 237 | Args: |
| 238 | objs: objects to pull from the cloud. |
| 239 | jobs: number of jobs that can be running simultaneously. |
| 240 | remote: optional name of remote to pull from. |
| 241 | By default remote from core.remote config option is used. |
| 242 | odb: optional ODB to pull from. Overrides remote. |
| 243 | """ |
| 244 | if odb is not None: |
| 245 | return self._pull(objs, jobs=jobs, odb=odb) |
| 246 | legacy_objs, default_objs = _split_legacy_hash_infos(objs) |
| 247 | result = TransferResult(set(), set()) |
| 248 | if legacy_objs: |
| 249 | odb = self.get_remote_odb(remote, "pull", hash_name="md5-dos2unix") |
| 250 | assert odb.hash_name == "md5-dos2unix" |
| 251 | t, f = self._pull(legacy_objs, jobs=jobs, odb=odb) |
| 252 | result.transferred.update(t) |
| 253 | result.failed.update(f) |
| 254 | if default_objs: |
| 255 | odb = self.get_remote_odb(remote, "pull") |
| 256 | t, f = self._pull(default_objs, jobs=jobs, odb=odb) |
| 257 | result.transferred.update(t) |
| 258 | result.failed.update(f) |
| 259 | return result |
| 260 | |
| 261 | def _pull( |
| 262 | self, |