romtools.hpc.components.archive#
Functions
|
Create a tar.gz archive of results. |
|
True if the patterns ask for the whole working directory. |
|
Safely extract a tarball on local or remote machine using POSIX sh. |
|
Validate and normalize file & directory patterns. |
- romtools.hpc.components.archive.create_tarball(log, run_cmd, working_dir, archive_path, patterns)[source]#
Create a tar.gz archive of results. Intended to work on either remote or local machine, depending on run_cmd.
Archives only the validated files/directories/glob patterns relative to the working directory.
Wildcard patterns are expanded relative to working_dir. Unmatched wildcard patterns are ignored with a warning.
- Raises:
ValueError – If the source_dir or input arguments are empty/invalid.
FileNotFoundError – If the validated paths do not exist.
RuntimeError – If the tarball creation or compression fails.
- Parameters:
log (Callable[[str], None])
run_cmd (Callable[[str], Result])
working_dir (str)
archive_path (str)
patterns (List[str] | None)
- Return type:
None
- romtools.hpc.components.archive.matches_everything(patterns)[source]#
True if the patterns ask for the whole working directory.
- Parameters:
patterns (List[str] | None)
- Return type:
bool
- romtools.hpc.components.archive.safe_extract_tar(run_cmd, archive_path, target_dir)[source]#
Safely extract a tarball on local or remote machine using POSIX sh.
Deletes the archive after successful extraction.
- romtools.hpc.components.archive.validate_file_patterns(collect_patterns)[source]#
Validate and normalize file & directory patterns.
- Returns:
None if collect_patterns is not specified
List[str] of cleaned patterns otherwise
- Raises:
ValueError – if any pattern is invalid.
- Parameters:
collect_patterns (List[str])
- Return type:
List[str] | None