-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: prioritize GPUs * fix: migrate db * fix: add priority * fix: db * fix: more * feat: model sources * feat: support delete API * feat: cli: support models sources add * feat: cli: model source delete * feat: cli: add model source list * feat: sync cortex.db * chore: cleanup * feat: add metadata for model * fix: migration * chore: unit tests: cleanup * fix: add metadata * fix: pull model * chore: unit tests: update * chore: add e2e tests for models sources * chore: add API docs * chore: rename --------- Co-authored-by: vansangpfiev <[email protected]>
- Loading branch information
1 parent
8dde05c
commit f473b0b
Showing
23 changed files
with
1,269 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "model_source_add_cmd.h" | ||
#include "server_start_cmd.h" | ||
#include "utils/json_helper.h" | ||
#include "utils/logging_utils.h" | ||
namespace commands { | ||
bool ModelSourceAddCmd::Exec(const std::string& host, int port, const std::string& model_source) { | ||
// Start server if server is not started yet | ||
if (!commands::IsServerAlive(host, port)) { | ||
CLI_LOG("Starting server ..."); | ||
commands::ServerStartCmd ssc; | ||
if (!ssc.Exec(host, port)) { | ||
return false; | ||
} | ||
} | ||
|
||
auto url = url_parser::Url{ | ||
.protocol = "http", | ||
.host = host + ":" + std::to_string(port), | ||
.pathParams = {"v1", "models", "sources"}, | ||
}; | ||
|
||
Json::Value json_data; | ||
json_data["source"] = model_source; | ||
|
||
auto data_str = json_data.toStyledString(); | ||
auto res = curl_utils::SimplePostJson(url.ToFullPath(), data_str); | ||
if (res.has_error()) { | ||
auto root = json_helper::ParseJsonString(res.error()); | ||
CLI_LOG(root["message"].asString()); | ||
return false; | ||
} | ||
|
||
CLI_LOG("Added model source: " << model_source); | ||
return true; | ||
} | ||
|
||
|
||
}; // namespace commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <unordered_map> | ||
|
||
namespace commands { | ||
|
||
class ModelSourceAddCmd { | ||
public: | ||
bool Exec(const std::string& host, int port, const std::string& model_source); | ||
}; | ||
} // namespace commands |
Oops, something went wrong.