Push data items in a cloud-agnostic way. Args: objs: objects to push to the cloud. jobs: number of jobs that can be running simultaneously. remote: optional name of remote to push to. By default remote from core.remote config option is use
(
self,
objs: Iterable["HashInfo"],
jobs: Optional[int] = None,
remote: Optional[str] = None,
odb: Optional["HashFileDB"] = None,
)
| 166 | return transfer(src_odb, dest_odb, objs, **kwargs) |
| 167 | |
| 168 | def push( |
| 169 | self, |
| 170 | objs: Iterable["HashInfo"], |
| 171 | jobs: Optional[int] = None, |
| 172 | remote: Optional[str] = None, |
| 173 | odb: Optional["HashFileDB"] = None, |
| 174 | ) -> "TransferResult": |
| 175 | """Push data items in a cloud-agnostic way. |
| 176 | |
| 177 | Args: |
| 178 | objs: objects to push to the cloud. |
| 179 | jobs: number of jobs that can be running simultaneously. |
| 180 | remote: optional name of remote to push to. |
| 181 | By default remote from core.remote config option is used. |
| 182 | odb: optional ODB to push to. Overrides remote. |
| 183 | """ |
| 184 | if odb is not None: |
| 185 | return self._push(objs, jobs=jobs, odb=odb) |
| 186 | legacy_objs, default_objs = _split_legacy_hash_infos(objs) |
| 187 | result = TransferResult(set(), set()) |
| 188 | if legacy_objs: |
| 189 | odb = self.get_remote_odb(remote, "push", hash_name="md5-dos2unix") |
| 190 | t, f = self._push(legacy_objs, jobs=jobs, odb=odb) |
| 191 | result.transferred.update(t) |
| 192 | result.failed.update(f) |
| 193 | if default_objs: |
| 194 | odb = self.get_remote_odb(remote, "push") |
| 195 | t, f = self._push(default_objs, jobs=jobs, odb=odb) |
| 196 | result.transferred.update(t) |
| 197 | result.failed.update(f) |
| 198 | return result |
| 199 | |
| 200 | def _push( |
| 201 | self, |