Skip to content

Commit

Permalink
update data_sync functions to utilize new size_only (and force) fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rpmcginty committed Jun 12, 2024
1 parent 0b43fbb commit 13573e1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/aibs_informatics_aws_utils/data_sync/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def sync_local_to_s3(self, source_path: LocalPath, destination_path: S3URI):
destination_path=destination_path,
transfer_config=self.s3_transfer_config,
config=self.botocore_config,
force=False,
force=self.config.force,
size_only=self.config.size_only,
delete=True,
)
if not self.config.retain_source_data:
Expand Down Expand Up @@ -93,7 +94,8 @@ def sync_paths_with_lock(*args, **kwargs):
destination_path=destination_path,
transfer_config=self.s3_transfer_config,
config=self.botocore_config,
force=False,
force=self.config.force,
size_only=self.config.size_only,
delete=True,
)

Expand Down Expand Up @@ -131,7 +133,8 @@ def sync_s3_to_s3(
source_path_prefix=source_path_prefix,
transfer_config=self.s3_transfer_config,
config=self.botocore_config,
force=False,
force=self.config.force,
size_only=self.config.size_only,
delete=True,
)
if not self.config.retain_source_data:
Expand Down Expand Up @@ -195,21 +198,25 @@ def sync_data(
max_concurrency: int = 10,
retain_source_data: bool = True,
require_lock: bool = False,
force: bool = False,
size_only: bool = False,
):
request = DataSyncRequest(
source_path=source_path,
destination_path=destination_path,
source_path_prefix=source_path_prefix,
source_path_prefix=S3KeyPrefix(source_path_prefix) if source_path_prefix else None,
max_concurrency=max_concurrency,
retain_source_data=retain_source_data,
require_lock=require_lock,
force=force,
size_only=size_only,
)
return DataSyncOperations.sync_request(request=request)


def refresh_local_path__mtime(path: Path, min_mtime: Union[int, float]):
paths = find_all_paths(path, include_dirs=False, include_files=True)
for path in paths:
path_stats = os.stat(path)
for subpath in paths:
path_stats = os.stat(subpath)
if path_stats.st_mtime < min_mtime:
os.utime(path, times=(path_stats.st_atime, min_mtime))
os.utime(subpath, times=(path_stats.st_atime, min_mtime))

0 comments on commit 13573e1

Please sign in to comment.