MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / ensure_model_ready

Method ensure_model_ready

tools/server/server-models.cpp:772–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

770}
771
772bool server_models::ensure_model_ready(const std::string & name) {
773 auto meta = get_meta(name);
774 if (!meta.has_value()) {
775 throw std::runtime_error("model name=" + name + " is not found");
776 }
777 if (meta->is_ready()) {
778 return false; // ready for taking requests
779 }
780 if (meta->status == SERVER_MODEL_STATUS_SLEEPING) {
781 return false; // child is sleeping but still running; new request will wake it up
782 }
783 if (meta->status == SERVER_MODEL_STATUS_UNLOADED) {
784 SRV_INF("model name=%s is not loaded, loading...\n", name.c_str());
785 load(name);
786 }
787
788 // wait for loading to complete
789 SRV_INF("waiting until model name=%s is fully loaded...\n", name.c_str());
790 wait_until_loading_finished(name);
791
792 // check final status
793 meta = get_meta(name);
794 if (!meta.has_value() || meta->is_failed()) {
795 throw std::runtime_error("model name=" + name + " failed to load");
796 }
797
798 return true;
799}
800
801server_http_res_ptr server_models::proxy_request(const server_http_req & req, const std::string & method, const std::string & name, bool update_last_used) {
802 auto meta = get_meta(name);

Callers 1

router_validate_modelFunction · 0.80

Calls 3

is_readyMethod · 0.80
is_failedMethod · 0.80
loadFunction · 0.50

Tested by

no test coverage detected