in src/sagemaker_training/intermediate_output.py [0:0]
def _copy_file(executor, s3_uploader, relative_path, filename):
"""Copy a file to a temporary directory."""
try:
src = os.path.join(intermediate_path, relative_path, filename)
dst = os.path.join(tmp_dir_path, relative_path, "{}.{}".format(_timestamp(), filename))
shutil.copy2(src, dst)
executor.submit(_upload_to_s3, s3_uploader, relative_path, dst, filename)
except FileNotFoundError: # noqa ignore=F821
# Broken link or deleted
pass
except Exception: # pylint: disable=broad-except
logger.exception("Failed to copy file to the temporary directory.")