Skip to content

Commit

Permalink
fix: record attachments mtimes after mounting vfs
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan MacLeod <[email protected]>
  • Loading branch information
npmacl authored and mwiebe committed Mar 22, 2024
1 parent deb2cca commit f0dcfa3
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/deadline/job_attachments/asset_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ def get_attachments(self, farm_id: str, queue_id: str, job_id: str) -> Optional[
)
return job.attachments if job and job.attachments else None

def _record_attachment_mtimes(
self, merged_manifests_by_root: dict[str, BaseAssetManifest]
) -> None:
# Record the mapping of downloaded files' absolute paths to their last modification time
# (in microseconds). This is used to later determine which files have been modified or
# newly created during the session and need to be uploaded as output.
for local_root, merged_manifest in merged_manifests_by_root.items():
for manifest_path in merged_manifest.paths:
abs_path = str(Path(local_root) / manifest_path.path)
self.synced_assets_mtime[abs_path] = Path(abs_path).stat().st_mtime_ns

def sync_inputs(
self,
s3_settings: Optional[JobAttachmentS3Settings],
Expand Down Expand Up @@ -427,6 +438,7 @@ def sync_inputs(
cas_prefix=s3_settings.full_cas_prefix(),
)
summary_statistics = SummaryStatistics()
self._record_attachment_mtimes(merged_manifests_by_root)
return (summary_statistics, list(pathmapping_rules.values()))
except VFSExecutableMissingError:
logger.error(
Expand Down Expand Up @@ -459,13 +471,7 @@ def sync_inputs(
else:
raise

# Record the mapping of downloaded files' absolute paths to their last modification time
# (in microseconds). This is used to later determine which files have been modified or
# newly created during the session and need to be uploaded as output.
for local_root, merged_manifest in merged_manifests_by_root.items():
for manifest_path in merged_manifest.paths:
abs_path = str(Path(local_root) / manifest_path.path)
self.synced_assets_mtime[abs_path] = Path(abs_path).stat().st_mtime_ns
self._record_attachment_mtimes(merged_manifests_by_root)

return (
download_summary_statistics.convert_to_summary_statistics(),
Expand Down

0 comments on commit f0dcfa3

Please sign in to comment.