(remote_path, local_path=None)
| 19 | |
| 20 | |
| 21 | def get_remote_file(remote_path, local_path=None): |
| 22 | hostname, path = remote_path.split(':') |
| 23 | local_hostname = socket.gethostname() |
| 24 | if hostname == local_hostname or hostname == local_hostname[:local_hostname.find('.')]: |
| 25 | return path |
| 26 | |
| 27 | if local_path is None: |
| 28 | local_path = path |
| 29 | # local_path = local_path.replace('/scr-ssd', '/scr') |
| 30 | if os.path.exists(local_path): |
| 31 | return local_path |
| 32 | local_dir = os.path.dirname(local_path) |
| 33 | os.makedirs(local_dir, exist_ok=True) |
| 34 | |
| 35 | print(f'Copying {hostname}:{path} to {local_path}') |
| 36 | os.system(f'scp {remote_path} {local_path}') |
| 37 | return local_path |
| 38 | |
| 39 | |
| 40 | def rank0_print(*args, **kwargs): |
nothing calls this directly
no outgoing calls
no test coverage detected