(self, save_path: str, saved_obj: Any, *args, async_upload=None, **kwargs)
| 481 | return meta.client.get_fns(*unpack_meta(meta)) |
| 482 | |
| 483 | def save(self, save_path: str, saved_obj: Any, *args, async_upload=None, **kwargs): |
| 484 | meta = self._get_client(path=save_path) |
| 485 | |
| 486 | if async_upload is None: |
| 487 | async_upload = self.async_mode |
| 488 | if async_upload: |
| 489 | assert ( |
| 490 | self.tmp_local_folder |
| 491 | ), "StorageManager is not setted tmp_local_folder, so async save cannot be performed." |
| 492 | tmp_step_file = meta.local_nvme_path |
| 493 | self._to_be_del_files.append(tmp_step_file) |
| 494 | with open(tmp_step_file, "wb") as f: |
| 495 | torch.save(saved_obj, f, pickle_protocol=pickle.HIGHEST_PROTOCOL) |
| 496 | self.async_executor(meta.async_upload_fn, *unpack_meta(meta)) |
| 497 | os.chmod(tmp_step_file, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) |
| 498 | self.async_task_peeding = True |
| 499 | else: |
| 500 | meta.client.sync_upload_fileobj(*unpack_meta(meta), *args, saved_obj=saved_obj, **kwargs) |
| 501 | self.upload_count += 1 |
| 502 | |
| 503 | def load(self, load_path: str, *args, **kwargs) -> Any: |
| 504 | self.wait() |
no test coverage detected