@aws/ml-container-creator 0.15.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/do/benchmark +14 -9
package/package.json
CHANGED
package/templates/do/benchmark
CHANGED
|
@@ -117,10 +117,12 @@ if [ "${ARG_STATUS}" = true ]; then
|
|
|
117
117
|
tar_file=""
|
|
118
118
|
tar_file=$(find "${LOCAL_RESULTS_DIR}" -name "output.tar.gz" -type f 2>/dev/null | head -1)
|
|
119
119
|
if [ -n "${tar_file}" ]; then
|
|
120
|
-
# Detect whether
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
# Detect whether ALL entries share a common leading directory prefix
|
|
121
|
+
_tar_prefix_count=""
|
|
122
|
+
_tar_prefix_count=$(tar -tzf "${tar_file}" 2>/dev/null | sed 's|/.*||' | sort -u | wc -l | tr -d ' ')
|
|
123
|
+
_tar_first_dir=""
|
|
124
|
+
_tar_first_dir=$(tar -tzf "${tar_file}" 2>/dev/null | head -1)
|
|
125
|
+
if [ "${_tar_prefix_count}" = "1" ] && echo "${_tar_first_dir}" | grep -qE '^[^/]+/$'; then
|
|
124
126
|
tar -xzf "${tar_file}" --strip-components=1 -C "${LOCAL_RESULTS_DIR}/output/" 2>/dev/null || true
|
|
125
127
|
else
|
|
126
128
|
tar -xzf "${tar_file}" -C "${LOCAL_RESULTS_DIR}/output/" 2>/dev/null || true
|
|
@@ -1097,11 +1099,14 @@ if [ "${JOB_STATUS}" = "Completed" ]; then
|
|
|
1097
1099
|
# Extract any tar.gz archives (benchmark service packages results as output.tar.gz)
|
|
1098
1100
|
for ARCHIVE in $(find "${LOCAL_RESULTS_DIR}" -name "*.tar.gz" -type f 2>/dev/null); do
|
|
1099
1101
|
ARCHIVE_DIR=$(dirname "${ARCHIVE}")
|
|
1100
|
-
# Detect whether
|
|
1101
|
-
#
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1102
|
+
# Detect whether ALL entries share a common leading directory prefix.
|
|
1103
|
+
# Only strip if every entry starts with the same dir (e.g., "output/file1", "output/file2").
|
|
1104
|
+
# A flat archive with mixed top-level files/dirs (e.g., "plots/", "profile_export.jsonl")
|
|
1105
|
+
# must NOT be stripped.
|
|
1106
|
+
_TAR_PREFIX=$(tar -tzf "${ARCHIVE}" 2>/dev/null | sed 's|/.*||' | sort -u | wc -l | tr -d ' ')
|
|
1107
|
+
_TAR_FIRST_DIR=$(tar -tzf "${ARCHIVE}" 2>/dev/null | head -1)
|
|
1108
|
+
if [ "${_TAR_PREFIX}" = "1" ] && echo "${_TAR_FIRST_DIR}" | grep -qE '^[^/]+/$'; then
|
|
1109
|
+
# Single common leading directory (e.g., all under "output/") — strip it
|
|
1105
1110
|
tar -xzf "${ARCHIVE}" --strip-components=1 -C "${ARCHIVE_DIR}" 2>/dev/null || true
|
|
1106
1111
|
else
|
|
1107
1112
|
# Flat archive — extract as-is
|