mirror of
https://github.com/baketnk/frame-yap.git
synced 2026-10-06 03:00:04 +02:00
Keep installed model-status checks from modifying release inventories
This commit is contained in:
1 parent
0681d4941a
commit
fe8726864e
5 files changed
+18
-3
No files matched your search
+1
-1
@@ -45,7 +45,7 @@ import urllib.request
|
|||||||
KEY = "local.frameyap.overlay"
|
KEY = "local.frameyap.overlay"
|
||||||
# The pinned release this installer belongs to (set in the release commit that
|
# The pinned release this installer belongs to (set in the release commit that
|
||||||
# is tagged vRELEASE_VERSION); empty in a development tree.
|
# is tagged vRELEASE_VERSION); empty in a development tree.
|
||||||
RELEASE_VERSION = "0.1.202610050143"
|
RELEASE_VERSION = "0.1.202610050153"
|
||||||
MARKER = "# FrameYap managed launcher v1\n"
|
MARKER = "# FrameYap managed launcher v1\n"
|
||||||
ARCHIVE_LIMIT = 12 * 1024**3
|
ARCHIVE_LIMIT = 12 * 1024**3
|
||||||
MEMBER_LIMIT = 50000
|
MEMBER_LIMIT = 50000
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import urllib.request
|
|||||||
KEY = "local.frameyap.overlay"
|
KEY = "local.frameyap.overlay"
|
||||||
# The pinned release this installer belongs to (set in the release commit that
|
# The pinned release this installer belongs to (set in the release commit that
|
||||||
# is tagged vRELEASE_VERSION); empty in a development tree.
|
# is tagged vRELEASE_VERSION); empty in a development tree.
|
||||||
RELEASE_VERSION = "0.1.202610050143"
|
RELEASE_VERSION = "0.1.202610050153"
|
||||||
MARKER = "# FrameYap managed launcher v1\n"
|
MARKER = "# FrameYap managed launcher v1\n"
|
||||||
ARCHIVE_LIMIT = 12 * 1024**3
|
ARCHIVE_LIMIT = 12 * 1024**3
|
||||||
MEMBER_LIMIT = 50000
|
MEMBER_LIMIT = 50000
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# Installed release inventories must remain unchanged by status queries.
|
||||||
|
sys.dont_write_bytecode = True
|
||||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "python"))
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "python"))
|
||||||
from frameyap.model_files import DEFAULT_MANIFEST_DIR, ManifestError, check_model, load_backends
|
from frameyap.model_files import DEFAULT_MANIFEST_DIR, ManifestError, check_model, load_backends
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ int model_status(const CliOptions& options, const char* executable) {
|
|||||||
script = fs::path(FRAMEYAP_SOURCE_ROOT) / "scripts/model-status.py";
|
script = fs::path(FRAMEYAP_SOURCE_ROOT) / "scripts/model-status.py";
|
||||||
if (!fs::is_regular_file(script))
|
if (!fs::is_regular_file(script))
|
||||||
throw std::runtime_error("model-status.py missing beside application layout: " + script.string());
|
throw std::runtime_error("model-status.py missing beside application layout: " + script.string());
|
||||||
std::vector<std::string> args{"python3", script.string()};
|
std::vector<std::string> args{"python3", "-B", script.string()};
|
||||||
if (options.mode == CliMode::ListModels) args.emplace_back("--list-models");
|
if (options.mode == CliMode::ListModels) args.emplace_back("--list-models");
|
||||||
else { args.emplace_back("--check-model"); args.push_back(options.model_id); }
|
else { args.emplace_back("--check-model"); args.push_back(options.model_id); }
|
||||||
if (!options.model_dir.empty()) { args.emplace_back("--model-dir"); args.push_back(options.model_dir); }
|
if (!options.model_dir.empty()) { args.emplace_back("--model-dir"); args.push_back(options.model_dir); }
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ check("${APP}" 0 "\"schema\": 1.*\"models\"|\"models\".*\"schema\": 1" --list-mo
|
|||||||
check("${APP}" 1 "\"state\": \"not_installed\"" --check-model redux --model-dir "${STAGE}/absent" --json)
|
check("${APP}" 1 "\"state\": \"not_installed\"" --check-model redux --model-dir "${STAGE}/absent" --json)
|
||||||
check("${APP}" 2 "^$" --check-model "redux;echo" --model-dir "${STAGE}/absent" --json)
|
check("${APP}" 2 "^$" --check-model "redux;echo" --model-dir "${STAGE}/absent" --json)
|
||||||
check("${APP}" 2 "^$" --check-model "../redux" --model-dir "${STAGE}/absent" --json)
|
check("${APP}" 2 "^$" --check-model "../redux" --model-dir "${STAGE}/absent" --json)
|
||||||
|
# Remove the previous fixture, including caches left by older test runs.
|
||||||
|
file(REMOVE_RECURSE "${STAGE}")
|
||||||
# Minimal installed payload, independent of the source tree's script/module/asset paths.
|
# Minimal installed payload, independent of the source tree's script/module/asset paths.
|
||||||
file(MAKE_DIRECTORY "${STAGE}/bin" "${STAGE}/scripts" "${STAGE}/python/frameyap" "${STAGE}/assets/backends")
|
file(MAKE_DIRECTORY "${STAGE}/bin" "${STAGE}/scripts" "${STAGE}/python/frameyap" "${STAGE}/assets/backends")
|
||||||
file(COPY "${APP}" DESTINATION "${STAGE}/bin")
|
file(COPY "${APP}" DESTINATION "${STAGE}/bin")
|
||||||
@@ -41,3 +43,14 @@ check("${STAGE}/bin/${name}" 0 "\"state\": \"installed_verified\""
|
|||||||
file(WRITE "${STAGE}/models/toy/weights.bin" "HELLO")
|
file(WRITE "${STAGE}/models/toy/weights.bin" "HELLO")
|
||||||
check("${STAGE}/bin/${name}" 1 "\"reason\": \"hash_mismatch\""
|
check("${STAGE}/bin/${name}" 1 "\"reason\": \"hash_mismatch\""
|
||||||
--check-model toy --manifest-dir "${STAGE}/fixtures" --model-dir "${STAGE}/models/toy" --json)
|
--check-model toy --manifest-dir "${STAGE}/fixtures" --model-dir "${STAGE}/models/toy" --json)
|
||||||
|
|
||||||
|
# The standalone script must also preserve the inventory without the launcher.
|
||||||
|
execute_process(COMMAND python3 "${STAGE}/scripts/model-status.py" --list-models
|
||||||
|
RESULT_VARIABLE standalone_status OUTPUT_QUIET ERROR_VARIABLE standalone_error)
|
||||||
|
if(NOT standalone_status EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Standalone model status failed: ${standalone_error}")
|
||||||
|
endif()
|
||||||
|
file(GLOB_RECURSE generated_cache "${STAGE}/python/*.pyc")
|
||||||
|
if(generated_cache OR EXISTS "${STAGE}/python/frameyap/__pycache__")
|
||||||
|
message(FATAL_ERROR "Offline model status modified the installed release: ${generated_cache}")
|
||||||
|
endif()
|
||||||
Reference in new issue
Block a user